Skip to content

Commit

Permalink
fix(kms): fix unused skipped UT
Browse files Browse the repository at this point in the history
ref: MANAGER-15856

Signed-off-by: Vincent BONMARCHAND <[email protected]>
  • Loading branch information
vovh authored and tibs245 committed Nov 25, 2024
1 parent dc23904 commit e49e3d3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
import { describe, it, expect } from 'vitest';
import {
getNextMonth,
getDaysFromDate,
addDaysToDate,
getDateFromDays,
} from './validityDateUtils';

describe.skip('getNextMonth', () => {
it('should return a date one month from now', () => {
const today = new Date();
const nextMonth = getNextMonth();

// Adjust the year if necessary (e.g., December to January)
const expectedMonth = (today.getMonth() + 1) % 12;
const expectedYear =
today.getFullYear() + (today.getMonth() === 11 ? 1 : 0);

expect(nextMonth.getMonth()).toBe(expectedMonth);
expect(nextMonth.getFullYear()).toBe(expectedYear);
});

it('should keep the same day of the month if possible', () => {
const today = new Date();
const nextMonth = getNextMonth();

const expectedDay = today.getDate();
expect(nextMonth.getDate()).toBe(expectedDay);
});
});

describe('getDaysFromDate', () => {
it('should return the correct number of days from today', () => {
const today = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ export function addDaysToDate(days: number): Date {
return targetDate;
}

export function getNextMonth(): Date {
const today = new Date();
today.setMonth(today.getMonth() + 1);
return today;
}

export function getDaysFromDate(date: Date): number {
const referenceDate = new Date();
const oneDay = 24 * 60 * 60 * 1000;
Expand Down

0 comments on commit e49e3d3

Please sign in to comment.