Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Add unit mixin tests for date-format and can-edit-requested (#867)
Browse files Browse the repository at this point in the history
* 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
mkly authored and jkleinsc committed Dec 14, 2016
1 parent 262860c commit 3189a11
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/unit/mixins/can-edit-requested-test.js
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);
});
27 changes: 27 additions & 0 deletions tests/unit/mixins/date-format-test.js
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'
);
});

0 comments on commit 3189a11

Please sign in to comment.