From 8fa94895b6d08b08ee217ffd6602964323c405cb Mon Sep 17 00:00:00 2001 From: Mike Lay Date: Tue, 7 Mar 2017 15:06:04 -0500 Subject: [PATCH] Add failing tests for appointments after 23:00 Add failing tests for appointments after 23:00 This sets the time to 23:40 so that the issues described in issue #976 are shown without setting the global system time Does not resolve issue, only sets test for it --- tests/acceptance/appointments-test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/acceptance/appointments-test.js b/tests/acceptance/appointments-test.js index eafb547080..8477c7b876 100644 --- a/tests/acceptance/appointments-test.js +++ b/tests/acceptance/appointments-test.js @@ -1,18 +1,30 @@ import Ember from 'ember'; import { module, test } from 'qunit'; import moment from 'moment'; +import sinon from 'sinon'; import startApp from 'hospitalrun/tests/helpers/start-app'; const DATE_TIME_FORMAT = 'l h:mm A'; const TIME_FORMAT = 'h:mm'; +const setIntervalNative = setInterval; +const clearIntervalNative = clearInterval; +let clock, interval; + module('Acceptance | appointments', { beforeEach() { + clock = sinon.useFakeTimers(new Date(2017, 0, 1, 23, 40, 0).getTime()); + interval = setIntervalNative(function() { + clock.tick(10); + }, 10); + this.application = startApp(); }, afterEach() { Ember.run(this.application, 'destroy'); + clock.restore(); + clearIntervalNative(interval); } });