mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 18:57:01 +00:00
[Search] Update tests
Test creation of the generic search provider provides mock timeout argument. Slight change to tree indexing test due to use of useCapability function.
This commit is contained in:
parent
3b62f1a979
commit
0520f1c70c
@ -31,6 +31,7 @@ define(
|
||||
|
||||
describe("The generic search provider ", function () {
|
||||
var mockQ,
|
||||
mockTimeout,
|
||||
mockDeferred,
|
||||
mockObjectService,
|
||||
mockObjectPromise,
|
||||
@ -57,6 +58,8 @@ define(
|
||||
mockDeferred.promise = "mock promise";
|
||||
mockQ.defer.andReturn(mockDeferred);
|
||||
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
|
||||
mockObjectService = jasmine.createSpyObj(
|
||||
"objectService",
|
||||
[ "getObjects" ]
|
||||
@ -83,7 +86,7 @@ define(
|
||||
mockDomainObjects[i] = (
|
||||
jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "hasCapability", "getCapability" ]
|
||||
[ "getId", "getModel", "hasCapability", "getCapability", "useCapability" ]
|
||||
)
|
||||
);
|
||||
mockDomainObjects[i].getId.andReturn(i);
|
||||
@ -102,14 +105,17 @@ define(
|
||||
mockCapability.invoke.andReturn(mockCapabilityPromise);
|
||||
mockDomainObjects[0].getCapability.andReturn(mockCapability);
|
||||
|
||||
provider = new GenericSearchProvider(mockQ, mockObjectService, mockWorkerService, mockRoots);
|
||||
provider = new GenericSearchProvider(mockQ, mockTimeout, mockObjectService, mockWorkerService, mockRoots);
|
||||
});
|
||||
|
||||
it("indexes tree on initialization", function () {
|
||||
mockObjectPromise.then.mostRecentCall.args[0](mockDomainObjects);
|
||||
mockCapabilityPromise.then.mostRecentCall.args[0](mockDomainObjects[1]);
|
||||
|
||||
expect(mockObjectService.getObjects).toHaveBeenCalled();
|
||||
expect(mockObjectPromise.then).toHaveBeenCalled();
|
||||
|
||||
mockObjectPromise.then.mostRecentCall.args[0](mockDomainObjects);
|
||||
|
||||
//mockCapabilityPromise.then.mostRecentCall.args[0](mockDomainObjects[1]);
|
||||
|
||||
expect(mockWorker.postMessage).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user