Skip to content

Commit

Permalink
Fixed Date.now() use in email analytics unit tests (#21188)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
9larsons authored Oct 2, 2024
1 parent 851ec7e commit c26aaca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ghost/email-analytics-service/test/email-analytics-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ const {
const EventProcessingResult = require('../lib/EventProcessingResult');

describe('EmailAnalyticsService', function () {
let clock;

beforeEach(function () {
clock = sinon.useFakeTimers(new Date(2024, 0, 1));
});

afterEach(function () {
clock.restore();
});

describe('getStatus', function () {
it('returns status object', function () {
// these are null because we're not running them before calling this
Expand Down

0 comments on commit c26aaca

Please sign in to comment.