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);