@@ -27,8 +27,10 @@ test_that("gemini_compare_pair_live parses a successful response without thought
2727 )
2828
2929 testthat :: local_mocked_bindings(
30- .gemini_req_perform = function (req ) fake_resp ,
31- .gemini_resp_status = function (resp ) 200L ,
30+ # ✅ Avoid hitting .get_api_key() / env
31+ .gemini_api_key = function (api_key = NULL ) " TEST_GEMINI_KEY" ,
32+ .gemini_req_perform = function (req ) fake_resp ,
33+ .gemini_resp_status = function (resp ) 200L ,
3234 .gemini_resp_body_json = function (resp , ... ) fake_body ,
3335 .env = ns
3436 )
@@ -100,8 +102,9 @@ test_that("gemini_compare_pair_live parses thoughts and content when include_tho
100102 )
101103
102104 testthat :: local_mocked_bindings(
103- .gemini_req_perform = function (req ) fake_resp ,
104- .gemini_resp_status = function (resp ) 200L ,
105+ .gemini_api_key = function (api_key = NULL ) " TEST_GEMINI_KEY" ,
106+ .gemini_req_perform = function (req ) fake_resp ,
107+ .gemini_resp_status = function (resp ) 200L ,
105108 .gemini_resp_body_json = function (resp , ... ) fake_body ,
106109 .env = ns
107110 )
@@ -160,8 +163,9 @@ test_that("gemini_compare_pair_live handles responses without <BETTER_SAMPLE> ta
160163 )
161164
162165 testthat :: local_mocked_bindings(
163- .gemini_req_perform = function (req ) fake_resp ,
164- .gemini_resp_status = function (resp ) 200L ,
166+ .gemini_api_key = function (api_key = NULL ) " TEST_GEMINI_KEY" ,
167+ .gemini_req_perform = function (req ) fake_resp ,
168+ .gemini_resp_status = function (resp ) 200L ,
165169 .gemini_resp_body_json = function (resp , ... ) fake_body ,
166170 .env = ns
167171 )
@@ -193,8 +197,9 @@ test_that("gemini_compare_pair_live returns an error row when request fails", {
193197
194198 # Simulate a generic error thrown by .gemini_req_perform
195199 testthat :: local_mocked_bindings(
196- .gemini_req_perform = function (req ) stop(" HTTP 500 Internal Server Error" ),
197- .gemini_resp_status = function (resp ) 500L ,
200+ .gemini_api_key = function (api_key = NULL ) " TEST_GEMINI_KEY" ,
201+ .gemini_req_perform = function (req ) stop(" HTTP 500 Internal Server Error" ),
202+ .gemini_resp_status = function (resp ) 500L ,
198203 .gemini_resp_body_json = function (resp , ... ) NULL ,
199204 .env = ns
200205 )
@@ -247,8 +252,9 @@ test_that("gemini_compare_pair_live validates model and maps thinking_level medi
247252 )
248253
249254 testthat :: local_mocked_bindings(
250- .gemini_req_perform = function (req ) fake_resp ,
251- .gemini_resp_status = function (resp ) 200L ,
255+ .gemini_api_key = function (api_key = NULL ) " TEST_GEMINI_KEY" ,
256+ .gemini_req_perform = function (req ) fake_resp ,
257+ .gemini_resp_status = function (resp ) 200L ,
252258 .gemini_resp_body_json = function (resp , ... ) fake_body ,
253259 .env = ns
254260 )
@@ -388,10 +394,10 @@ test_that("submit_gemini_pairs_live calls gemini_compare_pair_live for each row
388394
389395 calls <<- append(calls , list (
390396 list (
391- ID1 = ID1 ,
392- ID2 = ID2 ,
393- model = model ,
394- thinking_level = thinking_level ,
397+ ID1 = ID1 ,
398+ ID2 = ID2 ,
399+ model = model ,
400+ thinking_level = thinking_level ,
395401 include_thoughts = include_thoughts
396402 )
397403 ))
0 commit comments