mirror of
https://github.com/nasa/openmct.git
synced 2025-05-07 19:18:36 +00:00
[Spec] Update spec for new usage
Add a test for new bounds setting behavior, update other tests to provide correct mocks for new usage of APIs. https://github.com/nasa/openmct/issues/1582
This commit is contained in:
parent
fbf736aaf7
commit
9f32b4b9cd
@ -136,26 +136,35 @@ define(['./TimeAPI'], function (TimeAPI) {
|
|||||||
var anotherMockTickSource;
|
var anotherMockTickSource;
|
||||||
var mockOffsets = {
|
var mockOffsets = {
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0
|
end: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockTickSource = jasmine.createSpyObj("clock", [
|
mockTickSource = jasmine.createSpyObj("clock", [
|
||||||
"on",
|
"on",
|
||||||
"off"
|
"off",
|
||||||
|
"currentValue"
|
||||||
]);
|
]);
|
||||||
|
mockTickSource.currentValue.andReturn(10);
|
||||||
mockTickSource.key = "mts";
|
mockTickSource.key = "mts";
|
||||||
|
|
||||||
anotherMockTickSource = jasmine.createSpyObj("clock", [
|
anotherMockTickSource = jasmine.createSpyObj("clock", [
|
||||||
"on",
|
"on",
|
||||||
"off"
|
"off",
|
||||||
|
"currentValue"
|
||||||
]);
|
]);
|
||||||
anotherMockTickSource.key = "amts";
|
anotherMockTickSource.key = "amts";
|
||||||
|
anotherMockTickSource.currentValue.andReturn(10);
|
||||||
|
|
||||||
api.addClock(mockTickSource);
|
api.addClock(mockTickSource);
|
||||||
api.addClock(anotherMockTickSource);
|
api.addClock(anotherMockTickSource);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("sets bounds based on current value", function () {
|
||||||
|
api.clock("mts", mockOffsets);
|
||||||
|
expect(api.bounds()).toEqual({start: 10, end: 11});
|
||||||
|
});
|
||||||
|
|
||||||
it("a new tick listener is registered", function () {
|
it("a new tick listener is registered", function () {
|
||||||
api.clock("mts", mockOffsets);
|
api.clock("mts", mockOffsets);
|
||||||
expect(mockTickSource.on).toHaveBeenCalledWith("tick", jasmine.any(Function));
|
expect(mockTickSource.on).toHaveBeenCalledWith("tick", jasmine.any(Function));
|
||||||
@ -180,8 +189,10 @@ define(['./TimeAPI'], function (TimeAPI) {
|
|||||||
it("on tick, observes offsets, and indicates tick in bounds callback", function () {
|
it("on tick, observes offsets, and indicates tick in bounds callback", function () {
|
||||||
var mockTickSource = jasmine.createSpyObj("clock", [
|
var mockTickSource = jasmine.createSpyObj("clock", [
|
||||||
"on",
|
"on",
|
||||||
"off"
|
"off",
|
||||||
|
"currentValue"
|
||||||
]);
|
]);
|
||||||
|
mockTickSource.currentValue.andReturn(100);
|
||||||
var tickCallback;
|
var tickCallback;
|
||||||
var boundsCallback = jasmine.createSpy("boundsCallback");
|
var boundsCallback = jasmine.createSpy("boundsCallback");
|
||||||
var clockOffsets = {
|
var clockOffsets = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user