I'm trying to get model value in ember unit test cases, but its's throwing error like currentModel is destroyed or not define.
Unit test code:
test('test userInfo', function (assert) {
let appRoute = this.subject();
let response = {
"name ": "Test User"
}
appRoute.getUserInfo(response);
assert.equal(appRoute.get('currentModel.userInfo'), response.name, "userInfo value");
assert.ok(appRoute);
});
Application route code:
getUserInfo: function (response) {
this.set('currentModel.userInfo', response.name);
},
Aucun commentaire:
Enregistrer un commentaire