X-Git-Url: http://njoseph.me/gitweb/nimcoon.git/blobdiff_plain/6f161e0bd890c7289b54ad8ccfd5b73a416ea478..a2d28598f44142969997ae56f6bd684c54d95e0b:/tests/tests.nim diff --git a/tests/tests.nim b/tests/tests.nim index dad726c..fd44065 100644 --- a/tests/tests.nim +++ b/tests/tests.nim @@ -13,7 +13,19 @@ suite "Playing direct links": check(sanitizeURL("https://www.youtube.com/watch\\?v\\=QOEMv0S8AcA") == expected) test "validate options": - let invalidOptions = to_table({"musicOnly": true, "feelingLucky": false, "fullScreen": true, "download": false}) + let invalidOptionsList = [ + to_table({"musicOnly": true, "feelingLucky": false, "fullScreen": true, "download": false}), + to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": true, "download": true}) + ] + for invalidOptions in invalidOptionsList: check(not isValidOptions(invalidOptions)) - let validOptions = to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": true, "download": true}) + let validOptionsList = [ + to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": false, "download": true}), + to_table({"musicOnly": false, "feelingLucky": true, "fullScreen": true, "download": false}) + ] + for validOptions in validOptionsList: check(isValidOptions(validOptions)) + + test "rewrite invidious urls": + let url = "https://invidious.snopyta.org/watch?v=sZhxCUay5ks" + check(rewriteInvidiousToYouTube(url) == "https://www.youtube.com/watch?v=sZhxCUay5ks")