[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:
Victor Woeltjen
2014-11-21 16:59:03 -08:00
parent 2b82262775
commit 99f9203e71
7 changed files with 214 additions and 7 deletions

View File

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