[Plot] Update failing specs

Update failing specs after changes for WTD-806.
This commit is contained in:
Victor Woeltjen
2015-04-17 16:42:15 -07:00
parent 955c4209f0
commit 74b9d68dc8
5 changed files with 55 additions and 99 deletions

View File

@ -55,57 +55,14 @@ define(
});
it("provides one buffer per telemetry object", function () {
expect(updater.getBuffers().length).toEqual(3);
expect(updater.getLineBuffers().length).toEqual(3);
});
it("changes buffer count if telemetry object counts change", function () {
mockSubscription.getTelemetryObjects
.andReturn([makeMockDomainObject('a')]);
updater.update();
expect(updater.getBuffers().length).toEqual(1);
});
it("maintains a buffer of received telemetry", function () {
// Count should be large enough to trigger a buffer resize
var count = 750,
i;
// Increment values exposed by subscription
function increment() {
Object.keys(testDomainValues).forEach(function (k) {
testDomainValues[k] += 1;
testRangeValues[k] += 1;
});
}
// Simulate a lot of telemetry updates
for (i = 0; i < count; i += 1) {
updater.update();
expect(updater.getLength(0)).toEqual(i + 1);
expect(updater.getLength(1)).toEqual(i + 1);
expect(updater.getLength(2)).toEqual(i + 1);
increment();
}
// Domain offset should be lowest domain value
expect(updater.getDomainOffset()).toEqual(3);
// Test against initial values, offset by count,
// as was the case during each update
for (i = 0; i < count; i += 1) {
expect(updater.getBuffers()[0][i * 2])
.toEqual(3 + i - 3);
expect(updater.getBuffers()[0][i * 2 + 1])
.toEqual(123 + i);
expect(updater.getBuffers()[1][i * 2])
.toEqual(7 + i - 3);
expect(updater.getBuffers()[1][i * 2 + 1])
.toEqual(456 + i);
expect(updater.getBuffers()[2][i * 2])
.toEqual(13 + i - 3);
expect(updater.getBuffers()[2][i * 2 + 1])
.toEqual(789 + i);
}
expect(updater.getLineBuffers().length).toEqual(1);
});
it("can handle delayed telemetry object availability", function () {
@ -124,7 +81,7 @@ define(
);
// Should have 0 buffers for 0 objects
expect(updater.getBuffers().length).toEqual(0);
expect(updater.getLineBuffers().length).toEqual(0);
// Restore the three objects the test subscription would
// normally have.
@ -132,30 +89,9 @@ define(
updater.update();
// Should have 3 buffers for 3 objects
expect(updater.getBuffers().length).toEqual(3);
expect(updater.getLineBuffers().length).toEqual(3);
});
it("shifts buffer upon expansion", function () {
// Count should be large enough to hit buffer's max size
var count = 1400,
i;
// Initial update; should have 3 in first position
// (a's initial domain value)
updater.update();
expect(updater.getBuffers()[0][1]).toEqual(123);
// Simulate a lot of telemetry updates
for (i = 0; i < count; i += 1) {
testDomainValues.a += 1;
testRangeValues.a += 1;
updater.update();
}
// Value at front of the buffer should have been pushed out
expect(updater.getBuffers()[0][1]).not.toEqual(123);
});
});
}
);