Add jest dev helper function for sleeping

This commit is contained in:
Wolfgang Huß 2022-08-22 10:40:16 +02:00
parent e91394948c
commit 29874e54a1

View File

@ -7,3 +7,11 @@
export function gql(strings) {
return strings.join('')
}
// sometime we have to wait to check a db state by having a look into the db in a certain moment
// or we wait a bit to check if we missed to set an await somewhere
export function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
// usage 4 seconds for example
// await sleep(4 * 1000)