@@ -2,7 +2,7 @@ import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors"
22import { wait } from "@stackframe/stack-shared/dist/utils/promises" ;
33import { afterAll , beforeAll , describe , expect } from 'vitest' ;
44import { test } from '../../../../helpers' ;
5- import { Project , User , niceBackendFetch } from '../../../backend-helpers' ;
5+ import { InternalApiKey , Project , User , niceBackendFetch } from '../../../backend-helpers' ;
66import {
77 TEST_TIMEOUT ,
88 TestDbManager ,
@@ -23,6 +23,9 @@ async function runQueryForCurrentProject(body: { query: string, params?: Record<
2323}
2424
2525async function waitForClickhouseUser ( email : string , expectedDisplayName : string ) {
26+ // ensure we definitely have project keys that don't expire (unlike an admin access token)
27+ await InternalApiKey . createAndSetProjectKeys ( ) ;
28+
2629 const timeoutMs = 180_000 ;
2730 const intervalMs = 2_000 ;
2831 const start = performance . now ( ) ;
@@ -34,11 +37,8 @@ async function waitForClickhouseUser(email: string, expectedDisplayName: string)
3437 email,
3538 } ,
3639 } ) ;
37- expect ( response ) . toMatchObject ( {
38- status : 200 ,
39- } ) ;
40- if ( response . body . result . length === 1 ) {
41- expect ( response . body . result [ 0 ] . display_name ) . toBe ( expectedDisplayName ) ;
40+ expect ( response . status ) . toBe ( 200 ) ;
41+ if ( response . body . result . length === 1 && response . body . result [ 0 ] . display_name === expectedDisplayName ) {
4242 return response ;
4343 }
4444 await wait ( intervalMs ) ;
0 commit comments