Closed kaustavdm closed 9 years ago
@kaustavdm seems jai is working on this.
@kumarrishav Oops, thanks! Assigned this to @jaipradeesh
describe("reset function cleans up data properly", function () {
var finder = new Applait.Finder();
beforeEach(function() {
finder.reset();
});
it("filematchcount, searchcompletecount and searchkey is cleared up", function() {
expect(finder.filematchcount).toBe(0);
expect(finder.searchcompletecount).toBe(0);
expect(finder.searchkey).toBe("");
});
});
@kaustavdm This should work, right?
@jaipradeesh as there is only one function to test, i think there is no need of before each()
@kumarrishav Yeah! I was in the middle of writing another function. But this was meant to ask Kaustav about the correct way of doing it.
ok cool :)
@jaipradeesh This scenario is slightly more complex. You need to trigger a search and then do the reset
. Otherwise, there is nothing to reset and this test will always pass. False positive.
To trigger search, you need to create a mock of navigator.getDeviceStorages
and of the enumerate
method, so that you can trigger finder.search(searchkey)
.
Once the search is done, then you trigger reset
and compare if everything has been cleaned or not.
Write specs to ensure that the
reset
method cleans up data properly.