AtlatestRepositorytube
1
;;; Test suite for (tube config)2
;;;3
;;; Tests configuration loading from environment variables.5
(import (sigil test)6
(sigil string)7
(sigil struct)8
(sigil process)9
(tube config))11
;; ========== Config Defaults ==========13
(test-group "tube-config defaults"14
(test "default platform is both"15
(let ((config (tube-config)))16
(assert-equal "both" (tube-config-default-platform config))))18
(test "default tokens are #f"19
(let ((config (tube-config)))20
(assert-false (tube-config-youtube-access-token config))21
(assert-false (tube-config-youtube-api-key config))22
(assert-false (tube-config-twitch-client-id config))23
(assert-false (tube-config-twitch-access-token config)))))25
;; ========== Config Construction ==========27
(test-group "tube-config construction"28
(test "creates config with all fields"29
(let ((config (tube-config30
youtube-access-token: "yt-token"31
youtube-api-key: "yt-key"32
twitch-client-id: "tw-id"33
twitch-access-token: "tw-token"34
default-platform: "youtube")))35
(assert-equal "yt-token" (tube-config-youtube-access-token config))36
(assert-equal "yt-key" (tube-config-youtube-api-key config))37
(assert-equal "tw-id" (tube-config-twitch-client-id config))38
(assert-equal "tw-token" (tube-config-twitch-access-token config))39
(assert-equal "youtube" (tube-config-default-platform config))))41
(test "tube-config? predicate works"42
(assert-true (tube-config? (tube-config)))43
(assert-false (tube-config? "not a config"))44
(assert-false (tube-config? 42))))46
(run-tests)