]>
Commit | Line | Data |
---|---|---|
1 | import | |
2 | tables, | |
3 | unittest | |
4 | ||
5 | import lib | |
6 | import nimcoon | |
7 | ||
8 | suite "Playing direct links": | |
9 | ||
10 | test "sanitize URL": | |
11 | let expected = "https://www.youtube.com/watch?v=QOEMv0S8AcA" | |
12 | check(sanitizeURL("https://youtu.be/QOEMv0S8AcA") == expected) | |
13 | check(sanitizeURL("https://www.youtube.com/watch\\?v\\=QOEMv0S8AcA") == expected) | |
14 | ||
15 | test "validate options": | |
16 | let invalidOptionsList = [ | |
17 | to_table({"musicOnly": true, "feelingLucky": false, "fullScreen": true, "download": false}), | |
18 | to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": true, "download": true}) | |
19 | ] | |
20 | for invalidOptions in invalidOptionsList: | |
21 | check(not isValidOptions(invalidOptions)) | |
22 | let validOptionsList = [ | |
23 | to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": false, "download": true}), | |
24 | to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": true, "download": false}) | |
25 | ] | |
26 | for validOptions in validOptionsList: | |
27 | check(isValidOptions(validOptions)) |