Skip to content

Commit 1745435

Browse files
committed
chore: fix flaky snapshot
1 parent 67f463c commit 1745435

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/server/column-privileges.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { app } from './utils'
33

44
test('list column privileges', async () => {
55
const res = await app.inject({ method: 'GET', path: '/column-privileges' })
6-
expect(
7-
res
8-
.json<PostgresColumnPrivileges[]>()
9-
.find(
10-
({ relation_schema, relation_name, column_name }) =>
11-
relation_schema === 'public' && relation_name === 'todos' && column_name === 'id'
12-
)
13-
).toMatchInlineSnapshot(
6+
const column = res
7+
.json<PostgresColumnPrivileges[]>()
8+
.find(
9+
({ relation_schema, relation_name, column_name }) =>
10+
relation_schema === 'public' && relation_name === 'todos' && column_name === 'id'
11+
)!
12+
// We don't guarantee order of privileges, but we want to keep the snapshots consistent.
13+
column.privileges.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))
14+
expect(column).toMatchInlineSnapshot(
1415
{ column_id: expect.stringMatching(/^\d+\.\d+$/) },
1516
`
1617
{

0 commit comments

Comments
 (0)