Skip to content

Commit 12536a0

Browse files
committed
refactor(protect): hoist badModelSchema to reduce duplication
Move badModelSchema definition to top-level of test describe block, alongside other schema definitions.
1 parent c662bbe commit 12536a0

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/protect/__tests__/error-codes.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ describe('FFI Error Code Preservation', () => {
2828
raw: csColumn('raw'),
2929
})
3030

31+
// Schema with non-existent column for triggering FFI UNKNOWN_COLUMN error
32+
const badModelSchema = csTable('test_table', {
33+
nonexistent: csColumn('nonexistent_column'),
34+
})
35+
3136
beforeAll(async () => {
3237
protectClient = await protect({ schemas: [testSchema, noIndexSchema] })
3338
})
@@ -203,11 +208,6 @@ describe('FFI Error Code Preservation', () => {
203208
})
204209

205210
describe('encryptModel error codes', () => {
206-
// Schema with non-existent column for triggering FFI error
207-
const badModelSchema = csTable('test_table', {
208-
nonexistent: csColumn('nonexistent_column'),
209-
})
210-
211211
it('returns UNKNOWN_COLUMN code for model with non-existent column', async () => {
212212
const model = { nonexistent: 'test value' }
213213

@@ -238,10 +238,6 @@ describe('FFI Error Code Preservation', () => {
238238
})
239239

240240
describe('bulkEncryptModels error codes', () => {
241-
const badModelSchema = csTable('test_table', {
242-
nonexistent: csColumn('nonexistent_column'),
243-
})
244-
245241
it('returns UNKNOWN_COLUMN code for models with non-existent column', async () => {
246242
const models = [{ nonexistent: 'value1' }, { nonexistent: 'value2' }]
247243

0 commit comments

Comments
 (0)