[Persistence] Use ids from TransactionManager API

Recommended during code review,
https://github.com/nasa/openmct/pull/1084#discussion_r71021889
This commit is contained in:
Victor Woeltjen
2016-07-15 12:23:33 -07:00
parent 550e60455b
commit eb6ddb5e45
4 changed files with 31 additions and 33 deletions

View File

@ -40,9 +40,12 @@ define(
mockTransactionManager,
mockPersistence,
mockDomainObject,
testId,
capability;
beforeEach(function () {
testId = "test-id";
mockQ = jasmine.createSpyObj("$q", ["when"]);
mockQ.when.andCallFake(function (val) {
return fastPromise(val);
@ -60,11 +63,10 @@ define(
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[
"getModel"
]
["getModel", "getId"]
);
mockDomainObject.getModel.andReturn({persisted: 1});
mockDomainObject.getId.andReturn(testId);
capability = new TransactionalPersistenceCapability(
mockQ,
@ -100,7 +102,7 @@ define(
it("clears transactions and delegates refresh calls", function () {
capability.refresh();
expect(mockTransactionManager.clearTransactionsFor)
.toHaveBeenCalledWith(mockDomainObject);
.toHaveBeenCalledWith(testId);
expect(mockPersistence.refresh)
.toHaveBeenCalled();
});