[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:
Shivam Dave 2015-06-24 12:31:40 -07:00
parent 8926d4b2fb
commit 13eef59e4f

View File

@ -33,10 +33,7 @@ define(
var mockUrl,
mockUrlFor,
urlService,
mockLocation,
mockDomainObject,
mockMode,
mockObject;
mockLocation;
beforeEach(function () {
mockLocation = jasmine.createSpyObj(
@ -52,16 +49,25 @@ define(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
),
mockContext = jasmine.createSpyObj('context', ['getPath']),
testViews = [
{ key: 'abc' },
{ key: 'def', someKey: 'some value' },
{ key: 'xyz' }
];
mockContext.getPath.andReturn(
[mockDomainObject]
);
mockDomainObject.useCapability.andCallFake(function (c) {
return (c === 'view') && testViews;
});
mockDomainObject.getId.andReturn(true);
mockDomainObject.getCapability.andCallFake(function (c) {
return c === 'context' && mockContext;
});
mockLocation.search.andReturn({ view: 'def' });
urlService.urlFor("browse", mockDomainObject);
});