test: tighten googlechat auth redaction assertion · openclaw/openclaw@9cb204b
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
File tree
extensions/googlechat/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -506,24 +506,23 @@ describe("googlechat google auth runtime", () => {
|
506 | 506 | it("does not disclose raw credential paths or OS errors when file reads fail", async () => { |
507 | 507 | const missingPath = path.join(os.tmpdir(), "googlechat-auth-missing", "service-account.json"); |
508 | 508 | |
509 | | -await expect( |
510 | | -resolveValidatedGoogleChatCredentials({ |
| 509 | +let thrown: unknown; |
| 510 | +try { |
| 511 | +await resolveValidatedGoogleChatCredentials({ |
511 | 512 | accountId: "default", |
512 | 513 | config: {}, |
513 | 514 | credentialSource: "file", |
514 | 515 | credentialsFile: missingPath, |
515 | 516 | enabled: true, |
516 | | -}), |
517 | | -).rejects.toThrow("Failed to load Google Chat service account file."); |
| 517 | +}); |
| 518 | +} catch (error) { |
| 519 | +thrown = error; |
| 520 | +} |
518 | 521 | |
519 | | -await expect( |
520 | | -resolveValidatedGoogleChatCredentials({ |
521 | | -accountId: "default", |
522 | | -config: {}, |
523 | | -credentialSource: "file", |
524 | | -credentialsFile: missingPath, |
525 | | -enabled: true, |
526 | | -}), |
527 | | -).rejects.not.toThrow(/ENOENT|service-account\.json|googlechat-auth-missing/); |
| 522 | +expect(thrown).toBeInstanceOf(Error); |
| 523 | +expect((thrown as Error).message).toBe("Failed to load Google Chat service account file."); |
| 524 | +expect((thrown as Error).message).not.toMatch( |
| 525 | +/ENOENT|service-account\.json|googlechat-auth-missing/, |
| 526 | +); |
528 | 527 | }); |
529 | 528 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。