From 658de1c1aea5792c2ae7f17baf202bb12d1baf46 Mon Sep 17 00:00:00 2001 From: "maruyama.t" Date: Tue, 16 Jan 2024 09:51:37 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20691:=20=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=82=B9=E8=87=AA=E5=8B=95=E5=89=B2=E3=82=8A?= =?UTF-8?q?=E5=BD=93=E3=81=A6=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=AE=E7=B5=90=E6=9E=9C=E3=81=8C=E7=95=B0?= =?UTF-8?q?=E5=B8=B8=E3=81=AB=E3=81=AA=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task3486: ライセンス自動割り当てのテストコードの結果が異常になる](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3486) 現在時刻と明示的に定義した日付の比較を行っていたことで、年を跨ぎ異常となっていた ## UIの変更 - Before/Afterのスクショなど - スクショ置き場 ## 動作確認状況 - ローカルで確認、develop環境で確認など ## 補足 - 相談、参考資料などがあれば --- .../src/test/licenseAutoAllocation.spec.ts | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/dictation_function/src/test/licenseAutoAllocation.spec.ts b/dictation_function/src/test/licenseAutoAllocation.spec.ts index 170862a..d0bf9ef 100644 --- a/dictation_function/src/test/licenseAutoAllocation.spec.ts +++ b/dictation_function/src/test/licenseAutoAllocation.spec.ts @@ -282,13 +282,9 @@ describe("licenseAutoAllocation", () => { it("有効期限が指定日のライセンスが自動更新されること(リトライ用)", async () => { if (!source) fail(); const context = new InvocationContext(); - // 11/22の日付を作成 - const dateSeptember22 = new Date(); - dateSeptember22.setMonth(11); - dateSeptember22.setDate(22); - dateSeptember22.setHours(23, 59, 59); - const currentDateEndTime = new DateWithDayEndTime(dateSeptember22); - + // 2023/11/22の日付を作成 + const date1122 = new Date(2023, 10, 22, 23, 59, 59); + const currentDateEndTime = new DateWithDayEndTime(date1122); // アカウント const account1 = await makeTestAccount( source, @@ -328,7 +324,7 @@ describe("licenseAutoAllocation", () => { auto_renew: false, }); - // 割り当て済みで有効期限が12/31のライセンス + // 割り当て済みで有効期限が11/22のライセンス await createLicense( source, 1, @@ -389,10 +385,9 @@ describe("licenseAutoAllocation", () => { null, null ); - // 割り当て済みの更新対象ではないライセンス const nextDate = new Date(); - nextDate.setDate(dateSeptember22.getDate() + 1); + nextDate.setDate(date1122.getDate() + 1); nextDate.setHours(23, 59, 59); // 時分秒を"23:59:59"に固定 nextDate.setMilliseconds(0); await createLicense( @@ -407,15 +402,13 @@ describe("licenseAutoAllocation", () => { null, null ); - // 有効期限が先の未割当ライセンスを作成 // idが100のものは有効期限が当日なので自動割り当て対象外 // idが101のものから割り当てられる for (let i = 0; i < 10; i++) { - const date = new Date(); - date.setDate(dateSeptember22.getDate() + i); - date.setHours(23, 59, 59); // 時分秒を"23:59:59"に固定 - date.setMilliseconds(0); + // 2023/11/22の日付を作成 + const date = new Date(2023, 10, 22, 23, 59, 59); + date.setDate(date.getDate() + i); await createLicense( source, i + 100, @@ -446,8 +439,7 @@ describe("licenseAutoAllocation", () => { null, null ); - - await licenseAutoAllocationProcessing(context, source, dateSeptember22); + await licenseAutoAllocationProcessing(context, source, date1122); const user1Allocated = await selectLicenseByAllocatedUser(source, user1.id); const user2Allocated = await selectLicenseByAllocatedUser(source, user2.id); const user3Allocated = await selectLicenseByAllocatedUser(source, user3.id);