|
1 | 1 | import { PostgrestClient } from '../src/index'
|
2 | 2 | import { Database } from './types.override'
|
| 3 | +import { Database as DatabaseWithOptions13 } from './types.override-with-options-postgrest13' |
3 | 4 |
|
4 | 5 | const REST_URL = 'http://localhost:3000'
|
5 | 6 | export const postgrest = new PostgrestClient<Database>(REST_URL)
|
6 | 7 | const REST_URL_13 = 'http://localhost:3001'
|
7 | 8 | const postgrest13 = new PostgrestClient<Database, { postgrestVersion: 13 }>(REST_URL_13)
|
| 9 | +const postgrest13FromDatabaseTypes = new PostgrestClient<DatabaseWithOptions13>(REST_URL_13) |
8 | 10 |
|
9 | 11 | const userColumn: 'catchphrase' | 'username' = 'username'
|
10 | 12 |
|
@@ -350,6 +352,9 @@ export const selectQueries = {
|
350 | 352 | selectSpreadOnManyRelation13: postgrest13
|
351 | 353 | .from(selectParams.selectSpreadOnManyRelation.from)
|
352 | 354 | .select(selectParams.selectSpreadOnManyRelation.select),
|
| 355 | + selectSpreadOnManyRelation13FromDatabaseType: postgrest13FromDatabaseTypes |
| 356 | + .from(selectParams.selectSpreadOnManyRelation.from) |
| 357 | + .select(selectParams.selectSpreadOnManyRelation.select), |
353 | 358 | selectWithDuplicatesFields: postgrest
|
354 | 359 | .from(selectParams.selectWithDuplicatesFields.from)
|
355 | 360 | .select(selectParams.selectWithDuplicatesFields.select),
|
@@ -1778,6 +1783,27 @@ test('select spread on many relation postgrest13', async () => {
|
1778 | 1783 | `)
|
1779 | 1784 | })
|
1780 | 1785 |
|
| 1786 | +test('select spread on many relation postgrest13FromDatabaseTypes', async () => { |
| 1787 | + const res = await selectQueries.selectSpreadOnManyRelation13FromDatabaseType.limit(1).single() |
| 1788 | + expect(res).toMatchInlineSnapshot(` |
| 1789 | + Object { |
| 1790 | + "count": null, |
| 1791 | + "data": Object { |
| 1792 | + "channel_id": 1, |
| 1793 | + "id": Array [ |
| 1794 | + 1, |
| 1795 | + ], |
| 1796 | + "message": Array [ |
| 1797 | + "Hello World 👋", |
| 1798 | + ], |
| 1799 | + }, |
| 1800 | + "error": null, |
| 1801 | + "status": 200, |
| 1802 | + "statusText": "OK", |
| 1803 | + } |
| 1804 | + `) |
| 1805 | +}) |
| 1806 | + |
1781 | 1807 | test('multiple times the same column in selection', async () => {
|
1782 | 1808 | const res = await selectQueries.selectWithDuplicatesFields.limit(1).single()
|
1783 | 1809 | expect(res).toMatchInlineSnapshot(`
|
|
0 commit comments