mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00
private: adds tokens controller
adds private api adds AuthTokenDto and AuthTokenWithSecretDto adds necessary methods in the users service adds RandomnessError Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
b586b9ffb2
commit
cbf6ac912a
10 changed files with 248 additions and 12 deletions
38
src/api/private/tokens/tokens.controller.spec.ts
Normal file
38
src/api/private/tokens/tokens.controller.spec.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { TokensController } from './tokens.controller';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { AuthToken } from '../../../users/auth-token.entity';
|
||||
|
||||
describe('TokensController', () => {
|
||||
let controller: TokensController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [TokensController],
|
||||
imports: [LoggerModule, UsersModule],
|
||||
})
|
||||
.overrideProvider(getRepositoryToken(User))
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(AuthToken))
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Identity))
|
||||
.useValue({})
|
||||
.compile();
|
||||
|
||||
controller = module.get<TokensController>(TokensController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue