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

Add unit mixin tests for date-format and can-edit-requested #867

Merged
merged 2 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
);
});