]> njoseph.me Git - nimcoon.git/blobdiff - tests/tests.nim
download and fullScreen are imcompatible options
[nimcoon.git] / tests / tests.nim
index a218596fd0543225f806a5afebb599b4449a7879..8b9e6d21ac1a95de1221d7f66e4344853df077f8 100644 (file)
@@ -1,6 +1,9 @@
-import unittest
+import
+  tables,
+  unittest
 
 import lib
+import nimcoon
 
 suite "Playing direct links":
 
@@ -8,3 +11,17 @@ suite "Playing direct links":
     let expected = "https://www.youtube.com/watch?v=QOEMv0S8AcA"
     check(sanitizeURL("https://youtu.be/QOEMv0S8AcA") == expected)
     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))