Skip to content

Commit 5017cd3

Browse files
committed
chore(review): use postgrest code instead of message
1 parent 58742a6 commit 5017cd3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/max-affected.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { PostgrestClient } from '../src/index'
22
import { Database } from './types.override'
3+
import { Database as DatabasePostgrest13 } from './types.override-with-options-postgrest13'
34
import { expectType } from 'tsd'
45
import { InvalidMethodError } from '../src/PostgrestFilterBuilder'
56

67
const REST_URL_13 = 'http://localhost:3001'
7-
const postgrest13 = new PostgrestClient<Database, { postgrestVersion: 13 }>(REST_URL_13)
8+
const postgrest13 = new PostgrestClient<DatabasePostgrest13>(REST_URL_13)
89
const postgrest12 = new PostgrestClient<Database>(REST_URL_13)
910

1011
describe('maxAffected', () => {
@@ -75,7 +76,7 @@ describe('maxAffected', () => {
7576
.maxAffected(2)
7677
const { error } = result
7778
expect(error).toBeDefined()
78-
expect(error?.message).toBe('Query result exceeds max-affected preference constraint')
79+
expect(error?.code).toBe('PGRST124')
7980
})
8081

8182
test('update should succeed when within maxAffected limit', async () => {
@@ -114,7 +115,7 @@ describe('maxAffected', () => {
114115
.select()
115116

116117
expect(error).toBeDefined()
117-
expect(error?.message).toBe('Query result exceeds max-affected preference constraint')
118+
expect(error?.code).toBe('PGRST124')
118119
})
119120

120121
test('delete should succeed when within maxAffected limit', async () => {

0 commit comments

Comments
 (0)