Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed Apr 23, 2024
1 parent d30219f commit 569fc38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/client/test/api-usage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ test('sql.literalValue', async () => {

expect(result).toEqual({search_path: 'abc'})
const result2 = await client.one(sql`show search_path`)
expect(result2).toEqual({search_path: '"$user", public'})
expect(result2?.search_path).toMatch(/\bpublic\b/)
})

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/client/test/pgp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ test('non-string array', async () => {
values: [],
})
const result = await db.query(statement)
expect(result).toEqual([{one: 1, two: '{}'}])
expect(result).toEqual([{one: 1, two: '{M,F}'}])
})

test('prepare statement command does not accept values', async () => {
Expand Down Expand Up @@ -189,9 +189,9 @@ test('type parsers', async () => {

const oidToTypname = Object.fromEntries(result.map(r => [r.oid, r]))
const mappedBuiltins = Object.entries(pgp.pg.types.builtins).map(([name, oid]) => ({
...oidToTypname[oid],
oid,
name,
...oidToTypname[oid],
}))

expect(mappedBuiltins).toMatchInlineSnapshot(`
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/slonik37.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ test('sql.literalValue', async () => {

expect(result).toEqual({search_path: 'abc'})
const result2 = await client.one(sql`show search_path`)
expect(result2).toEqual({search_path: '"$user", public'})
expect(result2?.search_path).toMatch(/\bpublic\b/)
})

/**
Expand Down
12 changes: 6 additions & 6 deletions packages/migrator/test/definitions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ describe('sort sql statements', () => {
{
"01.one.sql": "create table patient(id int primary key, name text)",
"02.two.sql": "
create type address as (street text, city text, state text, zip text);
create type patient_type as enum ('human', 'animal');
",
create type address as (street text, city text, state text, zip text);
create type patient_type as enum ('human', 'animal');
",
"03.three.sql": "
alter table patient add column address address;
alter table patient add column type patient_type;
",
alter table patient add column address address;
alter table patient add column type patient_type;
",
"definitions.sql": "create type "public"."patient_type" as enum ('human', 'animal');
create type "public"."address" as ("street" text, "city" text, "state" text, "zip" text);
Expand Down

0 comments on commit 569fc38

Please sign in to comment.