chore(useremails): fix tests

This commit is contained in:
Alessandro Magionami
2024-07-25 17:26:29 +02:00
parent c7bcf5210f
commit d10fd393df
2 changed files with 18 additions and 12 deletions
@@ -9,18 +9,20 @@ export async function up(knex: Knex): Promise<void> {
tableName: 'users',
batchSize
})) {
await knex('user_emails')
.insert(
rows.map((user) => ({
id: crs({ length: 10 }),
userId: user.id,
email: user.email,
verified: user.verified,
primary: true
}))
)
.onConflict(['userId', 'email'])
.ignore()
if (rows.length) {
await knex('user_emails')
.insert(
rows.map((user) => ({
id: crs({ length: 10 }),
userId: user.id,
email: user.email,
verified: user.verified,
primary: true
}))
)
.onConflict(['userId', 'email'])
.ignore()
}
}
}
@@ -13,6 +13,10 @@ import {
const scanTable = scanTableFactory<UserRecord>({ db })
describe('Helpers scanTable @core', () => {
before(async () => {
await db(Users.name).delete()
})
it('should scan table', async () => {
const users = Array.from(Array(10)).map(() => ({
id: crs({ length: 6 }),