]> njoseph.me Git - nimcoon.git/blobdiff - tests/tests.nim
Fix all recent bugs. Shift to Invidious API.
[nimcoon.git] / tests / tests.nim
index 8b9e6d21ac1a95de1221d7f66e4344853df077f8..fd44065992227c86e599c42513a6d2229a56e228 100644 (file)
@@ -13,15 +13,19 @@ suite "Playing direct links":
     check(sanitizeURL("https://www.youtube.com/watch\\?v\\=QOEMv0S8AcA") == expected)
 
   test "validate options":
     check(sanitizeURL("https://www.youtube.com/watch\\?v\\=QOEMv0S8AcA") == expected)
 
   test "validate options":
-      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 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))
+    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 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")