[Persistence] Update failing spec

...for instantiation capability, to reflect usage of identifier
parser in determining which space an object should belong to.
This commit is contained in:
Victor Woeltjen 2015-11-10 12:26:59 -08:00
parent 689f80bb23
commit 44eb723efb

@ -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));
});
});