[Frontend] Code style cleanups in Timer *spec files

Fixes #623
Moved testState() function placement in code;
Added semicolons;
This commit is contained in:
Charles Hacskaylo 2017-01-26 15:09:01 -08:00
parent 4072b91808
commit 6459f410e7
4 changed files with 48 additions and 48 deletions

View File

@ -39,6 +39,18 @@ define(
}; };
} }
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(PauseTimerAction.appliesTo(testContext)).toBeTruthy();
} else {
expect(PauseTimerAction.appliesTo(testContext)).toBeFalsy();
}
}
beforeEach(function () { beforeEach(function () {
mockNow = jasmine.createSpy('now'); mockNow = jasmine.createSpy('now');
mockDomainObject = jasmine.createSpyObj( mockDomainObject = jasmine.createSpyObj(
@ -88,18 +100,6 @@ define(
//not a timer //not a timer
testState('clock', 'started', 12000, false); testState('clock', 'started', 12000, false);
}); });
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(PauseTimerAction.appliesTo(testContext)).toBeTruthy()
} else {
expect(PauseTimerAction.appliesTo(testContext)).toBeFalsy()
}
}
}); });
} }
); );

View File

@ -39,6 +39,18 @@ define(
}; };
} }
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(RestartTimerAction.appliesTo(testContext)).toBeTruthy();
} else {
expect(RestartTimerAction.appliesTo(testContext)).toBeFalsy();
}
}
beforeEach(function () { beforeEach(function () {
mockNow = jasmine.createSpy('now'); mockNow = jasmine.createSpy('now');
mockDomainObject = jasmine.createSpyObj( mockDomainObject = jasmine.createSpyObj(
@ -94,18 +106,6 @@ define(
//not a timer //not a timer
testState('clock', 'paused', 12000, false); testState('clock', 'paused', 12000, false);
}); });
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(RestartTimerAction.appliesTo(testContext)).toBeTruthy()
} else {
expect(RestartTimerAction.appliesTo(testContext)).toBeFalsy()
}
}
}); });
} }
); );

View File

@ -39,6 +39,18 @@ define(
}; };
} }
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(StartTimerAction.appliesTo(testContext)).toBeTruthy();
} else {
expect(StartTimerAction.appliesTo(testContext)).toBeFalsy();
}
}
beforeEach(function () { beforeEach(function () {
mockNow = jasmine.createSpy('now'); mockNow = jasmine.createSpy('now');
mockDomainObject = jasmine.createSpyObj( mockDomainObject = jasmine.createSpyObj(
@ -93,18 +105,6 @@ define(
//not a timer //not a timer
testState('clock', 'paused', 12000, false); testState('clock', 'paused', 12000, false);
}); });
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(StartTimerAction.appliesTo(testContext)).toBeTruthy()
} else {
expect(StartTimerAction.appliesTo(testContext)).toBeFalsy()
}
}
}); });
} }
); );

View File

@ -39,6 +39,18 @@ define(
}; };
} }
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(StopTimerAction.appliesTo(testContext)).toBeTruthy();
} else {
expect(StopTimerAction.appliesTo(testContext)).toBeFalsy();
}
}
beforeEach(function () { beforeEach(function () {
mockNow = jasmine.createSpy('now'); mockNow = jasmine.createSpy('now');
mockDomainObject = jasmine.createSpyObj( mockDomainObject = jasmine.createSpyObj(
@ -93,18 +105,6 @@ define(
//not a timer //not a timer
testState('clock', 'paused', 12000, false); testState('clock', 'paused', 12000, false);
}); });
function testState(type, timerState, timestamp, expected) {
testModel.type = type;
testModel.timerState = timerState;
testModel.timestamp = timestamp;
if (expected) {
expect(StopTimerAction.appliesTo(testContext)).toBeTruthy()
} else {
expect(StopTimerAction.appliesTo(testContext)).toBeFalsy()
}
}
}); });
} }
); );