| 1 |
|
| 2 |
|
| 3 |
import testUtils from "./test_utils"; |
| 4 |
const { DateTime } = luxon; |
| 5 |
|
| 6 |
QUnit.module('web', {}, function () { |
| 7 |
QUnit.module('testUtils', {}, function () { |
| 8 |
|
| 9 |
QUnit.module('patch date'); |
| 10 |
|
| 11 |
QUnit.test('new date', function (assert) { |
| 12 |
assert.expect(5); |
| 13 |
const unpatchDate = testUtils.mock.patchDate(2018, 9, 23, 14, 50, 0); |
| 14 |
|
| 15 |
const date = new Date(); |
| 16 |
|
| 17 |
assert.strictEqual(date.getFullYear(), 2018); |
| 18 |
assert.strictEqual(date.getMonth(), 9); |
| 19 |
assert.strictEqual(date.getDate(), 23); |
| 20 |
assert.strictEqual(date.getHours(), 14); |
| 21 |
assert.strictEqual(date.getMinutes(), 50); |
| 22 |
unpatchDate(); |
| 23 |
}); |
| 24 |
|
| 25 |
QUnit.test('new moment', function (assert) { |
| 26 |
assert.expect(1); |
| 27 |
const unpatchDate = testUtils.mock.patchDate(2018, 9, 23, 14, 50, 0); |
| 28 |
|
| 29 |
assert.strictEqual(DateTime.now().toFormat("yyyy-MM-dd HH:mm"), '2018-10-23 14:50'); |
| 30 |
unpatchDate(); |
| 31 |
}); |
| 32 |
|
| 33 |
}); |
| 34 |
}); |