|
41 | 41 | ["SELECT name FROM sqlite_master WHERE type='table'"]) |
42 | 42 | table-names (set (map :sqlite_master/name tables))] |
43 | 43 | (testing "Then: the set should contain the tables created by migrations" |
44 | | - (is (contains? table-names "skills") "Skills table exists") |
45 | | - (is (contains? table-names "prompts") "Prompts table exists")))))) |
| 44 | + (is (contains? table-names "skills")) |
| 45 | + (is (contains? table-names "prompts"))))))) |
46 | 46 |
|
47 | 47 | ;; Tests for db init command |
48 | 48 | (deftest db-init-command-test |
|
162 | 162 | ;; 3. Stats |
163 | 163 | (let [{:keys [output]} (capture-output #(cli/cmd-stats {})) |
164 | 164 | parsed (tu/parse-json-output output)] |
165 | | - (is (= "stats" (:type parsed))) |
166 | | - (is (map? (:database parsed)))) |
| 165 | + (is (match? {:type "stats" |
| 166 | + :database map?} |
| 167 | + parsed))) |
167 | 168 |
|
168 | 169 | ;; 4. Reset |
169 | 170 | (let [{:keys [output]} (capture-output #(cli/cmd-reset-db {:force true}))] |
|
180 | 181 | (with-redefs [cli/load-config-and-db mock-load-config-and-db] |
181 | 182 | (testing "When: We request database statistics" |
182 | 183 | (let [{:keys [output]} (capture-output #(cli/cmd-stats {})) |
183 | | - parsed (tu/parse-json-output output) |
184 | | - config (:configuration parsed)] |
| 184 | + parsed (tu/parse-json-output output)] |
185 | 185 | (testing "Then: Configuration should include config file paths" |
186 | | - (is (contains? config :config-file-path) "config-file-path is present") |
187 | | - (is (string? (:config-file-path config)) "config-file-path is a string") |
188 | | - (is (contains? config :project-config-path) "project-config-path is present") |
189 | | - (is (string? (:project-config-path config)) "project-config-path is a string") |
190 | | - (is (contains? config :database-path) "database-path is present") |
191 | | - (is (string? (:database-path config)) "database-path is a string")))))))) |
| 186 | + (is (match? {:type "stats" |
| 187 | + :configuration {:config-file-path string? |
| 188 | + :project-config-path string? |
| 189 | + :database-path string?}} |
| 190 | + parsed))))))))) |
0 commit comments