Skip to content

Commit 3f204e5

Browse files
committed
fix: use query() instead of none() in E2E test helper
1 parent be1c2a5 commit 3f204e5

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

tests/e2e/utils/jobs.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ export async function addJob(
2424
taskIdentifier: string,
2525
payload: Record<string, any>
2626
): Promise<Job> {
27-
await pg.none(
28-
`SELECT set_config('jwt.claims.database_id', $1, true)`,
29-
[databaseId]
30-
);
3127
const job = await pg.oneOrNone<Job>(
32-
`SELECT * FROM app_jobs.add_job($1::text, $2::json)`,
33-
[taskIdentifier, JSON.stringify(payload)]
28+
`WITH _cfg AS (
29+
SELECT set_config('jwt.claims.database_id', $1, true)
30+
)
31+
SELECT j.* FROM _cfg, app_jobs.add_job($2::text, $3::json) AS j`,
32+
[databaseId, taskIdentifier, JSON.stringify(payload)]
3433
);
3534
if (!job) {
3635
throw new Error(`Failed to add job: ${taskIdentifier}`);

0 commit comments

Comments
 (0)