Skip to content

Commit b42cfa0

Browse files
committed
Fix tests
1 parent ca40c50 commit b42cfa0

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/eca/shared_test.clj

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,19 @@
3232
(shared/assoc-some {} :a 1 :b)))))
3333

3434
(deftest tokens->cost-test
35-
(let [db {:models {"provider/my-model" {:input-token-cost 0.01
36-
:output-token-cost 0.02
37-
:input-cache-creation-token-cost 0.005
38-
:input-cache-read-token-cost 0.001}}}]
35+
(let [model-capabilities {:input-token-cost 0.01
36+
:output-token-cost 0.02
37+
:input-cache-creation-token-cost 0.005
38+
:input-cache-read-token-cost 0.001}]
3939
(testing "basic input/output cost"
40-
(is (= "0.70" (shared/tokens->cost 30 nil nil 20 "provider/my-model" db))))
40+
(is (= "0.70" (shared/tokens->cost 30 nil nil 20 model-capabilities))))
4141
(testing "with cache creation tokens"
42-
(is (= "0.75" (shared/tokens->cost 30 10 nil 20 "provider/my-model" db))))
42+
(is (= "0.75" (shared/tokens->cost 30 10 nil 20 model-capabilities))))
4343
(testing "with cache read tokens"
44-
(is (= "0.73" (shared/tokens->cost 30 nil 30 20 "provider/my-model" db))))
44+
(is (= "0.73" (shared/tokens->cost 30 nil 30 20 model-capabilities))))
4545
(testing "with both cache creation and read tokens"
46-
(is (= "0.78" (shared/tokens->cost 30 10 30 20 "provider/my-model" db))))
46+
(is (= "0.78" (shared/tokens->cost 30 10 30 20 model-capabilities))))
4747
(testing "returns nil when model is missing from db"
48-
(is (nil? (shared/tokens->cost 30 nil nil 20 "unknown" db))))
48+
(is (nil? (shared/tokens->cost 30 nil nil 20 {}))))
4949
(testing "returns nil when mandatory costs are missing"
50-
(is (nil? (shared/tokens->cost 30 nil nil 20 "my-model-missing"
51-
{:models {"my-model-missing" {:input-token-cost 0.01}}}))))))
50+
(is (nil? (shared/tokens->cost 30 nil nil 20 {:input-token-cost 0.01}))))))

0 commit comments

Comments
 (0)