Created
August 1, 2021 06:33
-
-
Save Goldziher/16b0462e603553414ea1ea3ccbc17e1a to your computer and use it in GitHub Desktop.
Example test
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 { getConnection } from 'typeorm'; | |
describe('Some Test', () => { | |
const connection = getConnection('default'); | |
let user: User; | |
beforeEach(async () => { | |
const userRepository = connection.getRepository(User); | |
const user = userRepository.create({ | |
firstName: 'John', | |
lastName: 'Smith', | |
email: 'js@test.com', | |
isActive: true, | |
profile: { | |
location: 'Berlin Metropolitan Area', | |
employer: 'Yo-Yo Inc.', | |
profession: 'Chef', | |
phoneNumber: '+491234567890', | |
imageUrl: 'https://www.example.com/user123', | |
birthDate: new Date('01.01.2000'), | |
}, | |
}); | |
await userRepository.save(user); | |
}); | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment