[Core] Complete spec for capailities
Complete specs for capabilities introduced in platform/core, part of ongoing transition of this bundle. WTD-573.
This commit is contained in:
@@ -9,6 +9,45 @@ define(
|
||||
"use strict";
|
||||
|
||||
describe("The persistence capability", function () {
|
||||
var mockPersistenceService,
|
||||
mockDomainObject,
|
||||
id = "object id",
|
||||
model = { someKey: "some value"},
|
||||
SPACE = "some space",
|
||||
persistence;
|
||||
|
||||
beforeEach(function () {
|
||||
mockPersistenceService = jasmine.createSpyObj(
|
||||
"persistenceService",
|
||||
[ "updateObject" ]
|
||||
);
|
||||
mockDomainObject = {
|
||||
getId: function () { return id; },
|
||||
getModel: function () { return model; }
|
||||
};
|
||||
persistence = new PersistenceCapability(
|
||||
mockPersistenceService,
|
||||
SPACE,
|
||||
mockDomainObject
|
||||
);
|
||||
});
|
||||
|
||||
it("makes a call to the persistence service when invoked", function () {
|
||||
// Verify precondition; no call made during constructor
|
||||
expect(mockPersistenceService.updateObject).not.toHaveBeenCalled();
|
||||
|
||||
persistence.persist();
|
||||
|
||||
expect(mockPersistenceService.updateObject).toHaveBeenCalledWith(
|
||||
SPACE,
|
||||
id,
|
||||
model
|
||||
);
|
||||
});
|
||||
|
||||
it("reports which persistence space an object belongs to", function () {
|
||||
expect(persistence.getSpace()).toEqual(SPACE);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user