chore(useremails): fix tests
This commit is contained in:
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user