[Time Conductor] Update specs

Update specs to reflect merge of latest from master into
topic branch for nasa/openmctweb#115, domain selector.
This commit is contained in:
Victor Woeltjen 2015-10-09 11:17:57 -07:00
parent 2accf21518
commit 5763511ec8
3 changed files with 40 additions and 37 deletions

View File

@ -129,11 +129,12 @@ define(
it("exposes conductor state in scope", function () {
mockConductor.displayStart.andReturn(1977);
mockConductor.displayEnd.andReturn(1984);
mockConductor.domain.andReturn('d');
representer.represent(testViews[0], {});
expect(mockNewScope.ngModel.conductor).toEqual({
inner: { start: 1977, end: 1984 },
outer: { start: 1977, end: 1984 }
inner: { start: 1977, end: 1984, domain: 'd' },
outer: { start: 1977, end: 1984, domain: 'd' }
});
});
@ -163,7 +164,9 @@ define(
});
describe("when bounds are changing", function () {
var mockThrottledFn = jasmine.createSpy('throttledFn'),
var startWatch = "ngModel.conductor.inner.start",
endWatch = "ngModel.conductor.inner.end",
mockThrottledFn = jasmine.createSpy('throttledFn'),
testBounds;
function fireThrottledFn() {
@ -174,7 +177,7 @@ define(
mockThrottle.andReturn(mockThrottledFn);
representer.represent(testViews[0], {});
testBounds = { start: 0, end: 1000 };
mockNewScope.conductor.inner = testBounds;
mockNewScope.ngModel.conductor.inner = testBounds;
mockConductor.displayStart.andCallFake(function () {
return testBounds.start;
});
@ -186,14 +189,14 @@ define(
it("does not broadcast while bounds are changing", function () {
expect(mockScope.$broadcast).not.toHaveBeenCalled();
testBounds.start = 100;
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
fireWatch(mockNewScope, startWatch, testBounds.start);
testBounds.end = 500;
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn();
testBounds.start = 200;
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
fireWatch(mockNewScope, startWatch, testBounds.start);
testBounds.end = 400;
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn();
expect(mockScope.$broadcast).not.toHaveBeenCalled();
});
@ -201,12 +204,12 @@ define(
it("does broadcast when bounds have stabilized", function () {
expect(mockScope.$broadcast).not.toHaveBeenCalled();
testBounds.start = 100;
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
fireWatch(mockNewScope, startWatch, testBounds.start);
testBounds.end = 500;
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn();
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
fireWatch(mockNewScope, startWatch, testBounds.start);
fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn();
expect(mockScope.$broadcast).toHaveBeenCalled();
});

View File

@ -75,8 +75,6 @@ define(
return j * j * j;
});
mockConductor.queryStart.andReturn(-12321);
mockConductor.queryEnd.andReturn(-12321);
mockConductor.displayStart.andReturn(42);
mockConductor.displayEnd.andReturn(1977);
mockConductor.domain.andReturn("testDomain");
@ -132,29 +130,29 @@ define(
expect(request.domain).toEqual(mockConductor.domain());
});
});
//
// it("adds display start/end times & domain selection to historical requests", function () {
// decorator.requestTelemetry([{ someKey: "some value" }]);
// expect(mockTelemetryService.requestTelemetry)
// .toHaveBeenCalledWith([{
// someKey: "some value",
// start: mockConductor.displayStart(),
// end: mockConductor.displayEnd(),
// domain: jasmine.any(String)
// }]);
// });
//
// it("adds display start/end times & domain selection to subscription requests", function () {
// var mockCallback = jasmine.createSpy('callback');
// decorator.subscribe(mockCallback, [{ someKey: "some value" }]);
// expect(mockTelemetryService.subscribe)
// .toHaveBeenCalledWith(jasmine.any(Function), [{
// someKey: "some value",
// start: mockConductor.displayStart(),
// end: mockConductor.displayEnd(),
// domain: jasmine.any(String)
// }]);
// });
it("adds display start/end times & domain selection to historical requests", function () {
decorator.requestTelemetry([{ someKey: "some value" }]);
expect(mockTelemetryService.requestTelemetry)
.toHaveBeenCalledWith([{
someKey: "some value",
start: mockConductor.displayStart(),
end: mockConductor.displayEnd(),
domain: jasmine.any(String)
}]);
});
it("adds display start/end times & domain selection to subscription requests", function () {
var mockCallback = jasmine.createSpy('callback');
decorator.subscribe(mockCallback, [{ someKey: "some value" }]);
expect(mockTelemetryService.subscribe)
.toHaveBeenCalledWith(jasmine.any(Function), [{
someKey: "some value",
start: mockConductor.displayStart(),
end: mockConductor.displayEnd(),
domain: jasmine.any(String)
}]);
});
});

View File

@ -24,6 +24,8 @@
define(
["../src/TimeConductor"],
function (TimeConductor) {
'use strict';
function TestTimeConductor() {
var self = this;