PDA

View Full Version : Jasmine mock out store load



ItDepends
29 Dec 2011, 4:38 AM
My idea was to load my store with dummydata from a .json file. Has anyone done this? I tried to spy on the load event of the store and return something, but that made the load return my data, what I'm looking for is getting the data into the store.

mitchellsimoens
29 Dec 2011, 9:28 AM
I would just have the data in the jasmine test and set the data config of the store. This way you don't have a dependance on loading of the store data.

ItDepends
2 Jan 2012, 1:01 AM
I tried that, but got an error when the method under test was trying to each over the store.



requirementsStore.each(function (requirement) {
if (requirement.RuleId() === ruleId) {
requirementsStore.remove(requirement);
}
}, this);

The data is not represented the same way internally in the store when setting the data property and when loading the store? It's normally a mixed collection when loading, but not when setting data property?