I have the following line of code inside a function I want to unit test:
var myStore = Ext.data.StoreManager.lookup("MyStore");
I am trying to mock the store inside my unit test as follows:
spyOn(Ext, 'data').and.returnValue({
StoreManager: {
lookup: function() {
return myMockStoreObjectForTestingPurposes;
}
}
});
However, for some reason the unit test is trying to use the real objects returned by Ext.data instead of my mock object.
Anyone know why this is happening? Should I be mocking Ext.data.StoreManager in a different way?
Aucun commentaire:
Enregistrer un commentaire