mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 08:48:28 +00:00
[Persistence] Update spec for instantiate
...to reflect usage of identifierService.
This commit is contained in:
parent
33f88d30ed
commit
76c1f5bfe9
@ -29,18 +29,27 @@ define(
|
||||
describe("The 'instantiate' service", function () {
|
||||
|
||||
var mockCapabilityService,
|
||||
mockIdentifierService,
|
||||
mockCapabilityConstructor,
|
||||
mockCapabilityInstance,
|
||||
mockCapabilities,
|
||||
mockIdentifier,
|
||||
idCounter,
|
||||
testModel,
|
||||
instantiate,
|
||||
domainObject;
|
||||
|
||||
beforeEach(function () {
|
||||
idCounter = 0;
|
||||
|
||||
mockCapabilityService = jasmine.createSpyObj(
|
||||
'capabilityService',
|
||||
['getCapabilities']
|
||||
);
|
||||
mockIdentifierService = jasmine.createSpyObj(
|
||||
'identifierService',
|
||||
[ 'parse', 'generate' ]
|
||||
);
|
||||
mockCapabilityConstructor = jasmine.createSpy('capability');
|
||||
mockCapabilityInstance = {};
|
||||
mockCapabilityService.getCapabilities.andReturn({
|
||||
@ -48,9 +57,17 @@ define(
|
||||
});
|
||||
mockCapabilityConstructor.andReturn(mockCapabilityInstance);
|
||||
|
||||
mockIdentifierService.generate.andCallFake(function (space) {
|
||||
return (space ? (space + ":") : "") +
|
||||
"some-id-" + (idCounter += 1);
|
||||
});
|
||||
|
||||
testModel = { someKey: "some value" };
|
||||
|
||||
instantiate = new Instantiate(mockCapabilityService);
|
||||
instantiate = new Instantiate(
|
||||
mockCapabilityService,
|
||||
mockIdentifierService
|
||||
);
|
||||
domainObject = instantiate(testModel);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user