Hello,
Sorry, I’m new in ember, and I have a problem with the tests. This code, work perfectly in development:
filteredLists: Ember.computed('currentUser.lists.@each.current', function(){ var ret = []; var lists = this.get('user.currentUser.lists'); lists.forEach(function(list){ //Here the problem, the playlist is in state of destroying and does not set the properties //always return 'undefined'. I tried putting an Ember.run in some places unsuccessfully. if(list.get('current') === false){ ret.pushObject(playlist); } }); return ret; }),
I’m trying to do an integration test:
Ember.run(function(){ //The user is loaded correctly from ember mirage. store.find('user', 1 ).then(function(user){ userStub.set('currentUser', user); }); }); return wait().then(() => { Ember.run(function(){ //Load the computed property lists = ctrl.get('filteredLists'); }); return wait().then(()=>{ assert.equal(lists.length, 5); }); });
I tried a lot of things, and there is no way to do it work because the list object is always destroying when the program access it to check the property.
This test is working for other code, but the other code has not to load the relationship and filter with it.
Somebody know how to fix ‘loading’ problems in tests with nested loads???
Thanks.