OMDSCloud/dictation_server/src/features/accounts/accounts.controller.spec.ts
makabe.t 69ff6f3432 Merged PR 493: API作成(アカウント情報取得(未認証時最小アクセス)API)
## 概要
[Task2807: API作成(アカウント情報取得(未認証時最小アクセス)API)](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2807)

- 未ログインユーザーについて、IDトークンを受け取ってユーザの所属するアカウントの階層情報を返却するAPIを実装しました。

## レビューポイント
- ContorollerでIDトークンをデコードしているが問題ないか?
  - ※ログインAPIを参考にしています。
- テストケースは適切か

## UIの変更
- なし

## 動作確認状況
- ローカルで確認
2023-10-13 05:33:02 +00:00

36 lines
1.0 KiB
TypeScript

import { Test, TestingModule } from '@nestjs/testing';
import { AccountsController } from './accounts.controller';
import { AccountsService } from './accounts.service';
import { ConfigModule } from '@nestjs/config';
import { AuthService } from '../auth/auth.service';
describe('AccountsController', () => {
let controller: AccountsController;
const mockAccountService = {};
const mockAuthService = {};
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
ConfigModule.forRoot({
envFilePath: ['.env.local', '.env'],
isGlobal: true,
}),
],
controllers: [AccountsController],
providers: [AccountsService, AuthService],
})
.overrideProvider(AccountsService)
.useValue(mockAccountService)
.overrideProvider(AuthService)
.useValue(mockAuthService)
.compile();
controller = module.get<AccountsController>(AccountsController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});