mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
[Windowing] Unit Test
Added mockContext to UrlServiceSpec unit test in order to reach the domainObject's context capability. WTD 16.
This commit is contained in:
parent
8926d4b2fb
commit
13eef59e4f
@ -33,10 +33,7 @@ define(
|
|||||||
var mockUrl,
|
var mockUrl,
|
||||||
mockUrlFor,
|
mockUrlFor,
|
||||||
urlService,
|
urlService,
|
||||||
mockLocation,
|
mockLocation;
|
||||||
mockDomainObject,
|
|
||||||
mockMode,
|
|
||||||
mockObject;
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockLocation = jasmine.createSpyObj(
|
mockLocation = jasmine.createSpyObj(
|
||||||
@ -52,16 +49,25 @@ define(
|
|||||||
"domainObject",
|
"domainObject",
|
||||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
[ "getId", "getCapability", "getModel", "useCapability" ]
|
||||||
),
|
),
|
||||||
|
mockContext = jasmine.createSpyObj('context', ['getPath']),
|
||||||
testViews = [
|
testViews = [
|
||||||
{ key: 'abc' },
|
{ key: 'abc' },
|
||||||
{ key: 'def', someKey: 'some value' },
|
{ key: 'def', someKey: 'some value' },
|
||||||
{ key: 'xyz' }
|
{ key: 'xyz' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
mockContext.getPath.andReturn(
|
||||||
|
[mockDomainObject]
|
||||||
|
);
|
||||||
|
|
||||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||||
return (c === 'view') && testViews;
|
return (c === 'view') && testViews;
|
||||||
});
|
});
|
||||||
mockDomainObject.getId.andReturn(true);
|
|
||||||
|
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||||
|
return c === 'context' && mockContext;
|
||||||
|
});
|
||||||
|
|
||||||
mockLocation.search.andReturn({ view: 'def' });
|
mockLocation.search.andReturn({ view: 'def' });
|
||||||
urlService.urlFor("browse", mockDomainObject);
|
urlService.urlFor("browse", mockDomainObject);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user