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

Commit

Permalink
Add mixin unit test for return-to (#891)
Browse files Browse the repository at this point in the history
- Add mixin unit test for return-to
  • Loading branch information
mkly authored and jkleinsc committed Dec 19, 2016
1 parent 79dd36c commit aa0dba3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/unit/mixins/return-to-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import ReturnTo from 'hospitalrun/mixins/return-to';
import { moduleFor, test } from 'ember-qunit';
import Ember from 'ember';
import DS from 'ember-data';

moduleFor('mixin:return-to', 'Unit | Mixin | return-to', {
subject(attrs) {
return Ember.run(() => {
let Test = DS.Model.extend(ReturnTo);
this.register('model:test', Test);
return this.store().createRecord('test', attrs);
});
},
store() {
return this.container.lookup('service:store');
}
});

test('cancelAction', function(assert) {
let returnTo = this.subject({
model: {
returnTo: 'test'
}
});

assert.strictEqual(returnTo.get('cancelAction'), 'returnTo');
});

test('cancelAction allItems', function(assert) {
let returnTo = this.subject();

assert.strictEqual(returnTo.get('cancelAction'), 'allItems');
});

0 comments on commit aa0dba3

Please sign in to comment.