/
postgres.test.js
43 lines (40 loc) · 1017 Bytes
/
postgres.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { basicDatabaseTest } = require('../desktop/panel/testutil');
const { withDocker } = require('./docker');
const BASIC_TESTS = [
{
type: 'postgres',
query: `SELECT 1 AS "1", 2.2 AS "2", true AS "true", 'string' AS "string", CAST('2021-01-01' AS DATE) AS "date"`,
},
{
type: 'postgres',
query:
'SELECT name, CAST(age AS INT) - 10 AS age, "location.city" AS city FROM DM_getPanel(0)',
},
];
const vendorOverride = {
postgres: {
address: 'localhost?sslmode=disable',
},
};
describe('basic postgres tests', () => {
for (const t of BASIC_TESTS) {
test(
t.query,
async () => {
await withDocker(
{
image: 'docker.io/library/postgres:latest',
port: '5432',
env: {
POSTGRES_USER: 'test',
POSTGRES_DB: 'test',
POSTGRES_PASSWORD: 'test',
},
},
() => basicDatabaseTest(t, vendorOverride)
);
},
360_000
);
}
});