mirror of
https://github.com/nasa/openmct.git
synced 2025-05-30 14:14:19 +00:00
[Persistence] Don't expect persist calls in specs
This commit is contained in:
parent
3905171457
commit
ac3706dfb6
@ -27,7 +27,6 @@ define(
|
|||||||
describe("A timer's start/restart action", function () {
|
describe("A timer's start/restart action", function () {
|
||||||
var mockNow,
|
var mockNow,
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
mockPersistence,
|
|
||||||
testModel,
|
testModel,
|
||||||
action;
|
action;
|
||||||
|
|
||||||
@ -45,10 +44,6 @@ define(
|
|||||||
'domainObject',
|
'domainObject',
|
||||||
[ 'getCapability', 'useCapability' ]
|
[ 'getCapability', 'useCapability' ]
|
||||||
);
|
);
|
||||||
mockPersistence = jasmine.createSpyObj(
|
|
||||||
'persistence',
|
|
||||||
['persist']
|
|
||||||
);
|
|
||||||
|
|
||||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||||
return (c === 'persistence') && mockPersistence;
|
return (c === 'persistence') && mockPersistence;
|
||||||
@ -67,18 +62,16 @@ define(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates the model with a timestamp and persists", function () {
|
it("updates the model with a timestamp", function () {
|
||||||
mockNow.andReturn(12000);
|
mockNow.andReturn(12000);
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(testModel.timestamp).toEqual(12000);
|
expect(testModel.timestamp).toEqual(12000);
|
||||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not truncate milliseconds", function () {
|
it("does not truncate milliseconds", function () {
|
||||||
mockNow.andReturn(42321);
|
mockNow.andReturn(42321);
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(testModel.timestamp).toEqual(42321);
|
expect(testModel.timestamp).toEqual(42321);
|
||||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ define(
|
|||||||
describe("A timer's restart action", function () {
|
describe("A timer's restart action", function () {
|
||||||
var mockNow,
|
var mockNow,
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
mockPersistence,
|
|
||||||
testModel,
|
testModel,
|
||||||
testContext,
|
testContext,
|
||||||
action;
|
action;
|
||||||
@ -46,14 +45,7 @@ define(
|
|||||||
'domainObject',
|
'domainObject',
|
||||||
[ 'getCapability', 'useCapability', 'getModel' ]
|
[ 'getCapability', 'useCapability', 'getModel' ]
|
||||||
);
|
);
|
||||||
mockPersistence = jasmine.createSpyObj(
|
|
||||||
'persistence',
|
|
||||||
['persist']
|
|
||||||
);
|
|
||||||
|
|
||||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
|
||||||
return (c === 'persistence') && mockPersistence;
|
|
||||||
});
|
|
||||||
mockDomainObject.useCapability.andCallFake(function (c, v) {
|
mockDomainObject.useCapability.andCallFake(function (c, v) {
|
||||||
if (c === 'mutation') {
|
if (c === 'mutation') {
|
||||||
testModel = v(testModel) || testModel;
|
testModel = v(testModel) || testModel;
|
||||||
@ -70,11 +62,10 @@ define(
|
|||||||
action = new RestartTimerAction(mockNow, testContext);
|
action = new RestartTimerAction(mockNow, testContext);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates the model with a timestamp and persists", function () {
|
it("updates the model with a timestamp", function () {
|
||||||
mockNow.andReturn(12000);
|
mockNow.andReturn(12000);
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(testModel.timestamp).toEqual(12000);
|
expect(testModel.timestamp).toEqual(12000);
|
||||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("applies only to timers with a target time", function () {
|
it("applies only to timers with a target time", function () {
|
||||||
|
@ -46,14 +46,7 @@ define(
|
|||||||
'domainObject',
|
'domainObject',
|
||||||
[ 'getCapability', 'useCapability', 'getModel' ]
|
[ 'getCapability', 'useCapability', 'getModel' ]
|
||||||
);
|
);
|
||||||
mockPersistence = jasmine.createSpyObj(
|
|
||||||
'persistence',
|
|
||||||
['persist']
|
|
||||||
);
|
|
||||||
|
|
||||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
|
||||||
return (c === 'persistence') && mockPersistence;
|
|
||||||
});
|
|
||||||
mockDomainObject.useCapability.andCallFake(function (c, v) {
|
mockDomainObject.useCapability.andCallFake(function (c, v) {
|
||||||
if (c === 'mutation') {
|
if (c === 'mutation') {
|
||||||
testModel = v(testModel) || testModel;
|
testModel = v(testModel) || testModel;
|
||||||
@ -70,11 +63,10 @@ define(
|
|||||||
action = new StartTimerAction(mockNow, testContext);
|
action = new StartTimerAction(mockNow, testContext);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates the model with a timestamp and persists", function () {
|
it("updates the model with a timestamp", function () {
|
||||||
mockNow.andReturn(12000);
|
mockNow.andReturn(12000);
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(testModel.timestamp).toEqual(12000);
|
expect(testModel.timestamp).toEqual(12000);
|
||||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("applies only to timers without a target time", function () {
|
it("applies only to timers without a target time", function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user