gcp-ai: the usage-options test asks no gcloud before the options are read (#667)

48a5f21's "the usage hook takes the billing, currency and profile maps"
test signed in with an accountId, so each of its usage calls first asked
gcloud for a token. On the publish run's ubuntu runner that took past
bun's 5s per-test limit, the test job went red, and gcp-ai 0.1.5 was
not published. The test now has no account, so nothing is asked before
the options are read and refused; it checks the same errors.

Run at this head on mote: `HOME=$(mktemp -d) bun test` (as publish.yml
runs it): 5195 pass, 0 fail, the test in 1.14ms. node --test
packages/gcp-ai/test/*.test.mjs: 84 tests, 81 pass, 3 skipped, 0 fail.
bun scripts/check.mjs: ok.

Not tried: the ubuntu runner itself; the first publish run on it will
show it.
This commit is contained in:
yetone
2026-11-03 18:20:55 +08:00
parent 48a5f21835
commit add66fc954
+2 -1
View File
@@ -1153,7 +1153,8 @@ test("account settings beat the row, and row settings beat environment defaults"
})
test("the usage hook takes the billing, currency and profile maps from the provider's or the plugin's options", async () => {
const auth = { accountId: "reader@example.com" }
// No account: nothing asks gcloud for a token before the options are read.
const auth = { type: "success" }
for (const [name, bad, wanted] of [
["billingAccounts", { "example-project": "nope" }, /billingAccounts: /],
["billingCurrencies", { "AAAAAA-BBBBBB-CCCCCC": "EUR" }, /billingCurrencies: "EUR" is not a currency/],