Skip to content

Commit a6aa84f

Browse files
committed
test(plugins): avoid brittle provider ref error text
1 parent 3b94949 commit a6aa84f

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/plugins/provider-auth-input.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,25 @@ describe("ensureApiKeyFromEnvOrPrompt", () => {
379379
expect(result).toBe("env-key");
380380
expectMinimaxEnvRefCredentialStored(setCredential);
381381
expect(note).toHaveBeenCalledWith(
382-
[
382+
expect.stringContaining(
383383
"Could not validate provider reference filemain:/providers/minimax/apiKey.",
384-
"secrets.providers.filemain.path is not readable: /tmp/does-not-exist-secrets.json | ENOENT: no such file or directory, lstat '/tmp/does-not-exist-secrets.json' | secrets.providers.filemain.path is not readable: /tmp/does-not-exist-secrets.json | ENOENT: no such file or directory, lstat '/tmp/does-not-exist-secrets.json'",
385-
"Check your provider configuration and try again.",
386-
].join("\n"),
384+
),
387385
"Reference check failed",
388386
);
387+
expect(note).toHaveBeenCalledWith(
388+
expect.stringContaining(
389+
"secrets.providers.filemain.path is not readable: /tmp/does-not-exist-secrets.json",
390+
),
391+
"Reference check failed",
392+
);
393+
expect(note).toHaveBeenCalledWith(
394+
expect.stringContaining("Check your provider configuration and try again."),
395+
"Reference check failed",
396+
);
397+
expect(note).toHaveBeenCalledWith(
398+
"Validated environment variable MINIMAX_API_KEY. OpenClaw will store a reference, not the key value.",
399+
"Reference validated",
400+
);
389401
});
390402

391403
it("never includes resolved env secret values in reference validation notes", async () => {

0 commit comments

Comments
 (0)