Merged PR 804: デグレ再発防止のため、修正をチェックするテストを作成
## 概要 [Task3830: デグレ再発防止のため、修正をチェックするテストを作成](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3830) - タスクを100件取得できることを確認するテストを追加 ## レビューポイント - テストでかくにんする項目は足りているか ## UIの変更 - 特になし ## クエリの変更 - 特になし ## 動作確認状況 - ローカルでテストが通ることを確認 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
2220e2560f
commit
7160e0ee2e
@ -946,6 +946,72 @@ describe('TasksService', () => {
|
||||
expect(task.jobNumber).toEqual('00000001');
|
||||
}
|
||||
});
|
||||
it('[Admin] Taskが100件であっても取得できる', async () => {
|
||||
const notificationhubServiceMockValue =
|
||||
makeDefaultNotificationhubServiceMockValue();
|
||||
if (!source) fail();
|
||||
const module = await makeTaskTestingModuleWithNotificaiton(
|
||||
source,
|
||||
notificationhubServiceMockValue,
|
||||
);
|
||||
if (!module) fail();
|
||||
const { id: accountId } = await makeTestSimpleAccount(source);
|
||||
const { external_id } = await makeTestUser(source, {
|
||||
account_id: accountId,
|
||||
external_id: 'userId',
|
||||
role: 'none',
|
||||
});
|
||||
const { id: authorUserId, author_id } = await makeTestUser(source, {
|
||||
account_id: accountId,
|
||||
external_id: 'userId',
|
||||
author_id: 'MY_AUTHOR_ID',
|
||||
role: 'author',
|
||||
});
|
||||
|
||||
const service = module.get<TasksService>(TasksService);
|
||||
for (let i = 0; i < 100; i++) {
|
||||
await createTask(
|
||||
source,
|
||||
accountId,
|
||||
authorUserId,
|
||||
author_id ?? '',
|
||||
`WORKTYPE${i + 1}`,
|
||||
'01',
|
||||
// 00000001 ~ 00000100
|
||||
`000000${String(i + 1).padStart(2, '0')}`,
|
||||
'Uploaded',
|
||||
);
|
||||
}
|
||||
const offset = 0;
|
||||
const limit = 100;
|
||||
const status = ['Uploaded', 'Backup'];
|
||||
const paramName = 'WORK_TYPE';
|
||||
const direction = 'DESC';
|
||||
|
||||
const { tasks, total } = await service.getTasks(
|
||||
makeContext('trackingId', 'requestId'),
|
||||
external_id,
|
||||
[ADMIN_ROLES.ADMIN, USER_ROLES.NONE],
|
||||
offset,
|
||||
limit,
|
||||
status,
|
||||
paramName,
|
||||
direction,
|
||||
);
|
||||
expect(tasks.length).toEqual(100);
|
||||
expect(total).toEqual(100);
|
||||
// ソート条件がWORK_TYPEのため、WORK_TYPEが降順になっていることを確認
|
||||
expect(tasks[0].workType).toEqual('WORKTYPE99');
|
||||
expect(tasks[99].workType).toEqual('WORKTYPE1');
|
||||
expect(tasks[0].optionItemList).toEqual(
|
||||
Array.from({ length: 10 }).map((_, i) => {
|
||||
return {
|
||||
optionItemLabel: `label${i}:audio_file_id${tasks[0].audioFileId}`,
|
||||
optionItemValue: `value${i}:audio_file_id${tasks[0].audioFileId}`,
|
||||
};
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -435,12 +435,14 @@ export class TasksService {
|
||||
`author_id not found. audioFileId: ${audioFileId}. account_id: ${user.account_id}`,
|
||||
);
|
||||
}
|
||||
const { external_id: authorExternalId, notification: authorNotification } =
|
||||
await this.usersRepository.findUserByAuthorId(
|
||||
context,
|
||||
task.file.author_id,
|
||||
user.account_id,
|
||||
);
|
||||
const {
|
||||
external_id: authorExternalId,
|
||||
notification: authorNotification,
|
||||
} = await this.usersRepository.findUserByAuthorId(
|
||||
context,
|
||||
task.file.author_id,
|
||||
user.account_id,
|
||||
);
|
||||
|
||||
// プライマリ管理者を取得
|
||||
const { external_id: primaryAdminExternalId } =
|
||||
|
||||
@ -903,7 +903,7 @@ export class SendGridService {
|
||||
// メールを送信する
|
||||
await this.sendMail(
|
||||
context,
|
||||
[authorEmail, typistEmail].filter((x): x is string => x !== null), // authorEmailがnullの場合は除外する
|
||||
[authorEmail, typistEmail].filter((x): x is string => x !== null), // authorEmailがnullの場合は除外する
|
||||
[],
|
||||
this.mailFrom,
|
||||
subject,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user