From 3f7356329ec1c8360c25d514e0b053dac8004787 Mon Sep 17 00:00:00 2001 From: Mike Lay Date: Tue, 13 Dec 2016 16:43:42 -0500 Subject: [PATCH 1/2] Add unit mixin test can-edit-requested - Add unit mixin test for `can-edit-requested` --- tests/unit/mixins/can-edit-requested-test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/unit/mixins/can-edit-requested-test.js diff --git a/tests/unit/mixins/can-edit-requested-test.js b/tests/unit/mixins/can-edit-requested-test.js new file mode 100644 index 0000000000..38ba77b406 --- /dev/null +++ b/tests/unit/mixins/can-edit-requested-test.js @@ -0,0 +1,19 @@ +import CanEditRequested from 'hospitalrun/mixins/can-edit-requested'; +import { moduleFor, test } from 'ember-qunit'; +import Ember from 'ember'; + +moduleFor('mixin:can-edit-requested', 'Unit | Mixin | can-edit-requested'); + +test('canEdit', function(assert) { + let canEditRequested = Ember.Object.extend(CanEditRequested).create({ + status: 'Requested' + }); + + assert.strictEqual(canEditRequested.get('canEdit'), true); +}); + +test('canEdit false', function(assert) { + let canEditRequested = Ember.Object.extend(CanEditRequested).create(); + + assert.strictEqual(canEditRequested.get('canEdit'), false); +}); From 25004b8b55f7c5ce6085bc6f9eb2b244f227c004 Mon Sep 17 00:00:00 2001 From: Mike Lay Date: Tue, 13 Dec 2016 16:45:19 -0500 Subject: [PATCH 2/2] Add unit mixin test date-format - Add unit mixin test for `date-format` Preserves current return values of `undefined` for non Date object or no argument passed in --- tests/unit/mixins/date-format-test.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/unit/mixins/date-format-test.js diff --git a/tests/unit/mixins/date-format-test.js b/tests/unit/mixins/date-format-test.js new file mode 100644 index 0000000000..2ced6ae43d --- /dev/null +++ b/tests/unit/mixins/date-format-test.js @@ -0,0 +1,27 @@ +import DateFormat from 'hospitalrun/mixins/date-format'; +import { moduleFor, test } from 'ember-qunit'; +import Ember from 'ember'; + +moduleFor('mixin:date-format', 'Unit | Mixin | date-format'); + +test('dateToTime', function(assert) { + let dateFormat = Ember.Object.extend(DateFormat).create(); + + assert.strictEqual( + dateFormat.dateToTime(new Date(1481665085175)), + 1481665085175, + 'Should return correct time' + ); + + assert.strictEqual( + dateFormat.dateToTime(), + undefined, + 'Should return undefined for no argument' + ); + + assert.strictEqual( + dateFormat.dateToTime(1481665085175), + undefined, + 'Should return undefined for non Date object' + ); +});