[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

@ -26,7 +26,7 @@ define(
function (TransactionManager) {
describe("TransactionManager", function () {
var mockTransactionService,
mockDomainObject,
testId,
mockOnCommit,
mockOnCancel,
mockRemoves,
@ -41,11 +41,7 @@ define(
);
mockOnCommit = jasmine.createSpy('commit');
mockOnCancel = jasmine.createSpy('cancel');
mockDomainObject = jasmine.createSpyObj(
'domainObject',
['getId', 'getModel', 'getCapability']
);
mockDomainObject.getId.andReturn('testId');
testId = 'test-id';
mockPromise = jasmine.createSpyObj('promise', ['then']);
mockOnCommit.andReturn(mockPromise);
@ -71,7 +67,7 @@ define(
describe("when addToTransaction is called", function () {
beforeEach(function () {
manager.addToTransaction(
mockDomainObject,
testId,
mockOnCommit,
mockOnCancel
);
@ -99,7 +95,7 @@ define(
it("ignores subsequent calls for the same object", function () {
manager.addToTransaction(
mockDomainObject,
testId,
jasmine.createSpy(),
jasmine.createSpy()
);
@ -108,9 +104,8 @@ define(
});
it("accepts subsequent calls for other objects", function () {
mockDomainObject.getId.andReturn('otherId');
manager.addToTransaction(
mockDomainObject,
'other-id',
jasmine.createSpy(),
jasmine.createSpy()
);
@ -124,7 +119,7 @@ define(
describe("and clearTransactionsFor is subsequently called", function () {
beforeEach(function () {
manager.clearTransactionsFor(mockDomainObject);
manager.clearTransactionsFor(testId);
});
it("removes callbacks from the transaction", function () {