diff --git a/tests/unit/mixins/return-to-test.js b/tests/unit/mixins/return-to-test.js new file mode 100644 index 0000000000..83fbde62aa --- /dev/null +++ b/tests/unit/mixins/return-to-test.js @@ -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'); +});