Skip to content

Commit 44ea6fc

Browse files
committed
test(prisma-next): guard the recorded bulk-decrypt call instead of unsafe ?.
Biome 2.5.3 (bumped in this group) adds lint/correctness/noUnsafeOptionalChaining, which correctly flags `(call?.ciphertexts[0] as ...).c` — if `call` were undefined the chain would throw anyway. Guard once and drop the optional chaining; behaviour identical, and the lint gate stays green on the new Biome. (The new version's extra useLiteralKeys/noNonNullAssertion findings are warnings, which CI permits.) Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
1 parent 95479f6 commit 44ea6fc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/prisma-next/test/decrypt-all.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,15 @@ describe('decryptAll — one bulkDecrypt per routing-key group', () => {
285285

286286
expect(sdk.bulkDecryptCalls).toHaveLength(1)
287287
const call = sdk.bulkDecryptCalls[0]
288-
expect(call?.ciphertexts).toHaveLength(3)
288+
if (!call) throw new Error('expected a recorded bulk decrypt call')
289+
expect(call.ciphertexts).toHaveLength(3)
289290
// Order is the walker's discovery order — for a flat array this
290291
// is the array's own order; the assertion pins that the bulk
291292
// decrypt's `ciphertexts` slot lines up with the envelopes the
292293
// walker visits in sequence.
293-
expect((call?.ciphertexts[0] as { c: string }).c).toBe('ct:x')
294-
expect((call?.ciphertexts[1] as { c: string }).c).toBe('ct:y')
295-
expect((call?.ciphertexts[2] as { c: string }).c).toBe('ct:z')
294+
expect((call.ciphertexts[0] as { c: string }).c).toBe('ct:x')
295+
expect((call.ciphertexts[1] as { c: string }).c).toBe('ct:y')
296+
expect((call.ciphertexts[2] as { c: string }).c).toBe('ct:z')
296297
})
297298

298299
it('groups by (sdk, routing key) so multi-tenant SDKs stay isolated', async () => {

0 commit comments

Comments
 (0)