mirror of
https://github.com/nasa/openmct.git
synced 2025-01-21 03:55:31 +00:00
[Time Controller] Begin adding test cases
WTD-1515
This commit is contained in:
parent
a481b377cb
commit
f83588d980
@ -29,8 +29,30 @@ define(
|
|||||||
function (ConductorService) {
|
function (ConductorService) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("ConductorService", function () {
|
var TEST_NOW = 1020304050;
|
||||||
|
|
||||||
|
describe("ConductorService", function () {
|
||||||
|
var mockNow,
|
||||||
|
conductorService;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
mockNow = jasmine.createSpy('now');
|
||||||
|
mockNow.andReturn(TEST_NOW);
|
||||||
|
conductorService = new ConductorService(mockNow);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("initializes a time conductor around the current time", function () {
|
||||||
|
var conductor = conductorService.getConductor();
|
||||||
|
expect(conductor.queryStart() <= TEST_NOW).toBeTruthy();
|
||||||
|
expect(conductor.queryEnd() >= TEST_NOW).toBeTruthy();
|
||||||
|
expect(conductor.queryEnd() > conductor.queryStart())
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("provides a single shared time conductor instance", function () {
|
||||||
|
expect(conductorService.getConductor())
|
||||||
|
.toBe(conductorService.getConductor());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -30,6 +30,33 @@ define(
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("TimeConductor", function () {
|
describe("TimeConductor", function () {
|
||||||
|
var testStart,
|
||||||
|
testEnd,
|
||||||
|
conductor;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
testStart = 42;
|
||||||
|
testEnd = 12321;
|
||||||
|
conductor = new TimeConductor(testStart, testEnd);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("provides accessors for query/display start/end times", function () {
|
||||||
|
expect(conductor.queryStart()).toEqual(testStart);
|
||||||
|
expect(conductor.queryEnd()).toEqual(testEnd);
|
||||||
|
expect(conductor.displayStart()).toEqual(testStart);
|
||||||
|
expect(conductor.displayEnd()).toEqual(testEnd);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("provides setters for query/display start/end times", function () {
|
||||||
|
expect(conductor.queryStart(1)).toEqual(1);
|
||||||
|
expect(conductor.queryEnd(2)).toEqual(2);
|
||||||
|
expect(conductor.displayStart(3)).toEqual(3);
|
||||||
|
expect(conductor.displayEnd(4)).toEqual(4);
|
||||||
|
expect(conductor.queryStart()).toEqual(1);
|
||||||
|
expect(conductor.queryEnd()).toEqual(2);
|
||||||
|
expect(conductor.displayStart()).toEqual(3);
|
||||||
|
expect(conductor.displayEnd()).toEqual(4);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user