This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit mixin tests for date-format and can-edit-requested (#867)
* Add unit mixin test can-edit-requested - Add unit mixin test for `can-edit-requested` * 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
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
); | ||
}); |