In unit tests, the idea is to drown out all external dependencies. In ember you can do this:
test('it should rollback changes on transition', function(assert) {
assert.expect(1);
let route = this.subject({
controller: Ember.Object.create({
model: Ember.Object.create({
rollbackAttributes() {
assert.ok(true, 'should call rollbackAttributes on a model');
}
})
})
});
route.actions.willTransition.call(route);
});
, , this.subject(), , ( ), , rollbackAttributes().
assert.expect(1); QUnit 1 .