[Search] Update tests

for 100% coverage.
This commit is contained in:
slhale 2015-08-18 12:37:47 -07:00
parent 17f2bb966b
commit 3d1e1659c2
2 changed files with 21 additions and 0 deletions

View File

@ -199,6 +199,10 @@ define(
mockPromise.then.mostRecentCall.args[0]({hits: [], total: 0});
expect(mockScope.ngModel.search).toEqual(false);
});
it("has a default results list to filter from", function () {
expect(mockScope.ngModel.filter()).toBeDefined();
});
});
}
);

View File

@ -119,8 +119,12 @@ define(
// Call through the children-getting part
mockTimeout.mostRecentCall.args[0]();
// Array argument indicates multiple children
mockCapabilityPromise.then.mostRecentCall.args[0]([]);
mockTimeout.mostRecentCall.args[0]();
// Call again, but for single child
mockCapabilityPromise.then.mostRecentCall.args[0]({});
mockTimeout.mostRecentCall.args[0]();
expect(mockWorker.postMessage).toHaveBeenCalled();
});
@ -150,6 +154,19 @@ define(
});
});
it("gives an empty result for an empty query", function () {
var timestamp = Date.now(),
queryOutput;
queryOutput = provider.query('', timestamp, 1, 2);
expect(queryOutput.hits).toEqual([]);
expect(queryOutput.total).toEqual(0);
queryOutput = provider.query();
expect(queryOutput.hits).toEqual([]);
expect(queryOutput.total).toEqual(0);
});
it("handles responses from the worker", function () {
var timestamp = Date.now(),
event = {