Skip to content

Commit 8a446c5

Browse files
committed
test: views typings
1 parent 3015ee0 commit 8a446c5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/basic.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ test('basic select table', async () => {
99
expect(res).toMatchSnapshot()
1010
})
1111

12+
test('basic select view', async () => {
13+
const res = await postgrest.from('updatable_view').select()
14+
expect(res).toMatchSnapshot()
15+
})
16+
1217
test('rpc', async () => {
1318
const res = await postgrest.rpc('get_status', { name_param: 'supabot' })
1419
expect(res).toMatchSnapshot()
@@ -410,3 +415,13 @@ test('select with no match', async () => {
410415
}
411416
`)
412417
})
418+
419+
test('cannot update non-updatable views', () => {
420+
// @ts-expect-error TS2345
421+
postgrest.from('non_updatable_view').update({})
422+
})
423+
424+
test('cannot update non-updatable columns', () => {
425+
// @ts-expect-error TS2322
426+
postgrest.from('updatable_view').update({ non_updatable_column: 0 as any })
427+
})

0 commit comments

Comments
 (0)