From 7160e0ee2e9cf02d6555d9d211b19690ca8ba96e Mon Sep 17 00:00:00 2001 From: "saito.k" Date: Wed, 6 Mar 2024 01:31:10 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20804:=20=E3=83=87=E3=82=B0?= =?UTF-8?q?=E3=83=AC=E5=86=8D=E7=99=BA=E9=98=B2=E6=AD=A2=E3=81=AE=E3=81=9F?= =?UTF-8?q?=E3=82=81=E3=80=81=E4=BF=AE=E6=AD=A3=E3=82=92=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task3830: デグレ再発防止のため、修正をチェックするテストを作成](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3830) - タスクを100件取得できることを確認するテストを追加 ## レビューポイント - テストでかくにんする項目は足りているか ## UIの変更 - 特になし ## クエリの変更 - 特になし ## 動作確認状況 - ローカルでテストが通ることを確認 ## 補足 - 相談、参考資料などがあれば --- .../src/features/tasks/tasks.service.spec.ts | 66 +++++++++++++++++++ .../src/features/tasks/tasks.service.ts | 14 ++-- .../src/gateways/sendgrid/sendgrid.service.ts | 2 +- 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/dictation_server/src/features/tasks/tasks.service.spec.ts b/dictation_server/src/features/tasks/tasks.service.spec.ts index 1531077..97f4ee2 100644 --- a/dictation_server/src/features/tasks/tasks.service.spec.ts +++ b/dictation_server/src/features/tasks/tasks.service.spec.ts @@ -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); + 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}`, + }; + }), + ); + }); }); }); diff --git a/dictation_server/src/features/tasks/tasks.service.ts b/dictation_server/src/features/tasks/tasks.service.ts index 898a8f9..8ddf007 100644 --- a/dictation_server/src/features/tasks/tasks.service.ts +++ b/dictation_server/src/features/tasks/tasks.service.ts @@ -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 } = diff --git a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts index ac9a5df..cd3edc4 100644 --- a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts +++ b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts @@ -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,