Skip to content

Commit 734d173

Browse files
anandgupta42claude
andcommitted
fix: reset dedup state in tests + replace passwords with fake values
- post-connect-suggestions.test.ts: add resetShownSuggestions() in beforeEach to prevent cross-file dedup state from causing the "after sql_execute suggests sql_analyze" test to fail in CI - connections.test.ts: replace "secret", "pw123", "ssh-pw", "access-token-123" with obviously fake test values to resolve GitGuardian false positives Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 24234ff commit 734d173

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

packages/opencode/test/altimate/connections.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe("detectAuthMethod", () => {
172172
})
173173

174174
test("returns 'password' for config with password", () => {
175-
expect(detectAuthMethod({ type: "postgres", password: "secret" } as any)).toBe("password")
175+
expect(detectAuthMethod({ type: "postgres", password: "test-fake-password" } as any)).toBe("password")
176176
})
177177

178178
test("returns 'file' for duckdb", () => {
@@ -188,7 +188,7 @@ describe("detectAuthMethod", () => {
188188
})
189189

190190
test("returns 'password' for mongo with password", () => {
191-
expect(detectAuthMethod({ type: "mongo", password: "secret" } as any)).toBe("password")
191+
expect(detectAuthMethod({ type: "mongo", password: "test-fake-password" } as any)).toBe("password")
192192
})
193193

194194
test("returns 'unknown' for null/undefined", () => {
@@ -207,7 +207,7 @@ describe("detectAuthMethod", () => {
207207

208208
describe("CredentialStore", () => {
209209
test("storeCredential returns false when keytar unavailable", async () => {
210-
const result = await CredentialStore.storeCredential("mydb", "password", "secret")
210+
const result = await CredentialStore.storeCredential("mydb", "password", "test-fake-password")
211211
expect(result).toBe(false)
212212
})
213213

@@ -267,7 +267,7 @@ describe("CredentialStore", () => {
267267
})
268268

269269
test("saveConnection strips OAuth credentials as sensitive", async () => {
270-
const config = { type: "snowflake", authenticator: "oauth", token: "access-token-123", oauth_client_secret: "secret" } as any
270+
const config = { type: "snowflake", authenticator: "oauth", token: "test-fake-token", oauth_client_secret: "test-fake-password" } as any
271271
const { sanitized } = await CredentialStore.saveConnection("sf_oauth", config)
272272
expect(sanitized.token).toBeUndefined()
273273
expect(sanitized.oauth_client_secret).toBeUndefined()
@@ -279,12 +279,12 @@ describe("CredentialStore", () => {
279279
type: "snowflake",
280280
account: "abc123",
281281
user: "svc_user",
282-
password: "pw123",
282+
password: "test-fake-pw",
283283
private_key: "-----BEGIN PRIVATE KEY-----",
284284
private_key_passphrase: "passphrase",
285285
token: "oauth-token",
286286
oauth_client_secret: "client-secret",
287-
ssh_password: "ssh-pw",
287+
ssh_password: "test-fake-ssh-pw",
288288
connection_string: "mongodb://...",
289289
} as any
290290
const { sanitized, warnings } = await CredentialStore.saveConnection("complex", config)
@@ -651,7 +651,7 @@ describe("Docker discovery", () => {
651651
host: "127.0.0.1",
652652
port: 5432,
653653
user: "admin",
654-
password: "secret",
654+
password: "test-fake-password",
655655
database: "mydb",
656656
status: "running",
657657
}
@@ -660,7 +660,7 @@ describe("Docker discovery", () => {
660660
expect(config.host).toBe("127.0.0.1")
661661
expect(config.port).toBe(5432)
662662
expect(config.user).toBe("admin")
663-
expect(config.password).toBe("secret")
663+
expect(config.password).toBe("test-fake-password")
664664
expect(config.database).toBe("mydb")
665665
})
666666

packages/opencode/test/altimate/post-connect-suggestions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const trackedEvents: any[] = []
88

99
beforeEach(() => {
1010
trackedEvents.length = 0
11+
PostConnectSuggestions.resetShownSuggestions()
1112
spyOn(Telemetry, "track").mockImplementation((event: any) => {
1213
trackedEvents.push(event)
1314
})

0 commit comments

Comments
 (0)