From 13eef59e4f73688340264576fa60df76c5eccbac Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Wed, 24 Jun 2015 12:31:40 -0700 Subject: [PATCH] [Windowing] Unit Test Added mockContext to UrlServiceSpec unit test in order to reach the domainObject's context capability. WTD 16. --- .../browse/test/services/UrlServiceSpec.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/browse/test/services/UrlServiceSpec.js b/platform/commonUI/browse/test/services/UrlServiceSpec.js index b03170c7ca..1bba48bd8d 100644 --- a/platform/commonUI/browse/test/services/UrlServiceSpec.js +++ b/platform/commonUI/browse/test/services/UrlServiceSpec.js @@ -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); });