[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:
@@ -28,19 +28,40 @@ define(
|
|||||||
|
|
||||||
describe("The 'instantiation' capability", function () {
|
describe("The 'instantiation' capability", function () {
|
||||||
var mockInjector,
|
var mockInjector,
|
||||||
|
mockIdentifierService,
|
||||||
mockInstantiate,
|
mockInstantiate,
|
||||||
|
mockIdentifier,
|
||||||
|
mockDomainObject,
|
||||||
instantiation;
|
instantiation;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
|
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
|
||||||
mockInstantiate = jasmine.createSpy("instantiate");
|
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) {
|
mockInjector.get.andCallFake(function (key) {
|
||||||
return key === 'instantiate' ?
|
return key === 'instantiate' ?
|
||||||
mockInstantiate : undefined;
|
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);
|
mockInstantiate.andReturn(mockDomainObject);
|
||||||
expect(instantiation.instantiate(testModel))
|
expect(instantiation.instantiate(testModel))
|
||||||
.toBe(mockDomainObject);
|
.toBe(mockDomainObject);
|
||||||
expect(mockInstantiate).toHaveBeenCalledWith(testModel);
|
expect(mockInstantiate)
|
||||||
|
.toHaveBeenCalledWith(testModel, jasmine.any(String));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user