test(user): write test for startTrialPeriod

This commit is contained in:
Ali BARIN
2024-11-14 15:11:20 +00:00
committed by Faruk AYDIN
parent 449b953401
commit 41622678b0
2 changed files with 17 additions and 2 deletions

View File

@@ -856,4 +856,19 @@ describe('User model', () => {
expect(user.password).toBe(undefined);
});
});
it('startTrialPeriod should assign trialExpiryDate 30 days from now', () => {
vi.useFakeTimers();
const date = new Date(2024, 10, 14, 16, 0, 0, 0);
vi.setSystemTime(date);
const user = new User();
user.startTrialPeriod();
expect(user.trialExpiryDate).toBe('2024-12-14');
vi.useRealTimers();
});
});