change getTokensByUsername to getTokensByUser

Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
Yannick Bungers 2021-10-13 22:22:08 +02:00 committed by David Mehren
parent 2ab3d7e8f9
commit be27686610
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
3 changed files with 12 additions and 14 deletions

View file

@ -74,12 +74,10 @@ describe('AuthService', () => {
expect(service).toBeDefined();
});
describe('getTokensByUsername', () => {
describe('getTokensByUser', () => {
it('works', async () => {
jest
.spyOn(userRepo, 'findOne')
.mockResolvedValueOnce({ ...user, authTokens: [authToken] });
const tokens = await service.getTokensByUsername(user.userName);
jest.spyOn(authTokenRepo, 'find').mockResolvedValueOnce([authToken]);
const tokens = await service.getTokensByUser(user);
expect(tokens).toHaveLength(1);
expect(tokens).toEqual([authToken]);
});