From 44eb723efba4db555ac03a7f58fd0f7f198b7936 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 10 Nov 2015 12:26:59 -0800 Subject: [PATCH] [Persistence] Update failing spec ...for instantiation capability, to reflect usage of identifier parser in determining which space an object should belong to. --- .../InstantiationCapabilitySpec.js | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/platform/core/test/capabilities/InstantiationCapabilitySpec.js b/platform/core/test/capabilities/InstantiationCapabilitySpec.js index 0798a68f0c..35e0530b38 100644 --- a/platform/core/test/capabilities/InstantiationCapabilitySpec.js +++ b/platform/core/test/capabilities/InstantiationCapabilitySpec.js @@ -28,19 +28,40 @@ define( describe("The 'instantiation' capability", function () { var mockInjector, + mockIdentifierService, mockInstantiate, + mockIdentifier, + mockDomainObject, instantiation; beforeEach(function () { mockInjector = jasmine.createSpyObj("$injector", ["get"]); mockInstantiate = jasmine.createSpy("instantiate"); + mockIdentifierService = jasmine.createSpyObj( + 'identifierService', + [ 'parse', 'generate' ] + ); + mockIdentifier = jasmine.createSpyObj( + 'identifier', + [ 'getSpace', 'getKey', 'getDefinedSpace' ] + ); + mockDomainObject = jasmine.createSpyObj( + 'domainObject', + [ 'getId', 'getCapability', 'getModel' ] + ); mockInjector.get.andCallFake(function (key) { return key === 'instantiate' ? mockInstantiate : undefined; }); + mockIdentifierService.parse.andReturn(mockIdentifier); + mockIdentifierService.generate.andReturn("some-id"); - instantiation = new InstantiationCapability(mockInjector); + instantiation = new InstantiationCapability( + mockInjector, + mockIdentifierService, + mockDomainObject + ); }); @@ -59,7 +80,8 @@ define( mockInstantiate.andReturn(mockDomainObject); expect(instantiation.instantiate(testModel)) .toBe(mockDomainObject); - expect(mockInstantiate).toHaveBeenCalledWith(testModel); + expect(mockInstantiate) + .toHaveBeenCalledWith(testModel, jasmine.any(String)); }); });