Created
August 1, 2021 06:37
-
-
Save Goldziher/2a85e71ef3d75e21942bdbba70f8d17c to your computer and use it in GitHub Desktop.
Re-written test example with batch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User } from '@backend/db/entities/User'; | |
import { UserFactory } from '@backend/db/factories/User.factory'; | |
import { getConnection } from 'typeorm'; | |
describe('Some Other Test', () => { | |
const connection = getConnection('default'); | |
let users: User[]; | |
beforeEach(async () => { | |
const userRepository = connection.getRepository(User); | |
users = await userRepository.save(UserFactory.batchSync(10)); | |
}); | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment