Skip to content

Commit

Permalink
Update testHelper.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Nov 18, 2024
1 parent ed1e5e4 commit f434a79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/tests/testHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export const initialize = async () => {
password: passwordHash,
type: bookcarsTypes.UserType.Admin,
})
//
// This check is necessary to avoid getting an error creating the same env admin multiple times when
// test suites are run in parallel.
//
adminFromEnv = await User.exists({ email: env.ADMIN_EMAIL, type: bookcarsTypes.UserType.Admin })
if (!adminFromEnv) {
await _admin.save()
Expand Down

0 comments on commit f434a79

Please sign in to comment.