0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed Date.now() use in email analytics unit tests (#21188)

no ref

We had an instance where this was a ms off and I should've used mock
timers when I first wrote this. This should prevent any rare clock
mishaps.
This commit is contained in:
Steve Larson 2024-10-02 12:54:48 -05:00 committed by GitHub
parent 851ec7eb0b
commit c26aacacf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,16 @@ const {
const EventProcessingResult = require('../lib/EventProcessingResult'); const EventProcessingResult = require('../lib/EventProcessingResult');
describe('EmailAnalyticsService', function () { describe('EmailAnalyticsService', function () {
let clock;
beforeEach(function () {
clock = sinon.useFakeTimers(new Date(2024, 0, 1));
});
afterEach(function () {
clock.restore();
});
describe('getStatus', function () { describe('getStatus', function () {
it('returns status object', function () { it('returns status object', function () {
// these are null because we're not running them before calling this // these are null because we're not running them before calling this