[Search] Update tests
for 100% coverage.
This commit is contained in:
@@ -199,6 +199,10 @@ define(
|
|||||||
mockPromise.then.mostRecentCall.args[0]({hits: [], total: 0});
|
mockPromise.then.mostRecentCall.args[0]({hits: [], total: 0});
|
||||||
expect(mockScope.ngModel.search).toEqual(false);
|
expect(mockScope.ngModel.search).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("has a default results list to filter from", function () {
|
||||||
|
expect(mockScope.ngModel.filter()).toBeDefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -119,8 +119,12 @@ define(
|
|||||||
|
|
||||||
// Call through the children-getting part
|
// Call through the children-getting part
|
||||||
mockTimeout.mostRecentCall.args[0]();
|
mockTimeout.mostRecentCall.args[0]();
|
||||||
|
// Array argument indicates multiple children
|
||||||
mockCapabilityPromise.then.mostRecentCall.args[0]([]);
|
mockCapabilityPromise.then.mostRecentCall.args[0]([]);
|
||||||
mockTimeout.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();
|
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 () {
|
it("handles responses from the worker", function () {
|
||||||
var timestamp = Date.now(),
|
var timestamp = Date.now(),
|
||||||
event = {
|
event = {
|
||||||
|
|||||||
Reference in New Issue
Block a user