matchbot/test/bot_test.clj

27 lines
985 B
Clojure

;; SPDX-License-Identifier: Apache-2.0
;; SPDX-FileCopyrightText: 2022 Sebastian Crane <seabass-labrax@gmx.com>
(ns bot-test
(:require [clojure.test :refer :all]
[bot :refer :all]))
(def test-state '{:games {:hypothetical-shooter #{"abc" "xyz" "123"}
:quasi-rts #{"abc" "123"}
:imaginary-rpg #{"xyz" "abc"}}})
(deftest match-string-test
(is (= '"Anyone ready for quasi-Rts? 123 abc"
(match-string test-state "quasi-Rts"))))
(deftest list-players-string-test
(is (= "Players of HYPOTHETICAL-shooter: _123_ _abc_ _xyz_"
(list-players-string test-state "HYPOTHETICAL-shooter"))))
(deftest add-player-string-test
(is (= "Added abc to the list of players for Quasi-Rts!"
(add-player-string "abc" "Quasi-Rts"))))
(deftest remove-player-string-test
(is (= "Removed abc from the list of players for hypothetical-shooter!"
(remove-player-string "abc" "hypothetical-shooter"))))