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 b70215a commit b490f5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/tests/testHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as logger from '../src/common/logger'

export const getName = (prefix: string) => {
expect(prefix.length).toBeGreaterThan(1)
return `${prefix}.${nanoid()}.${Date.now()}`.toLowerCase()
return `${prefix}.${nanoid()}`.toLowerCase()
}

export const getSupplierName = () => getName('supplier')
Expand Down Expand Up @@ -53,8 +53,9 @@ export const initialize = async () => {
expect(admin.id).toBeTruthy()
ADMIN_USER_ID = admin.id

// env admin
if (env.ADMIN_EMAIL) {
const adminFromEnv = await User.findOne({ email: env.ADMIN_EMAIL })
const adminFromEnv = await User.exists({ email: env.ADMIN_EMAIL, type: bookcarsTypes.UserType.Admin })
if (!adminFromEnv) {
const _admin = new User({
fullName: 'admin',
Expand Down

0 comments on commit b490f5a

Please sign in to comment.