[Time Conductor] Test TelemetryHandle.getDatum

Test ability to look up datum object by index (used to
support evaluation of limit state in Fixed Position and
similar single-value views while time conducting.)
This commit is contained in:
Victor Woeltjen 2015-12-30 10:23:02 -08:00
parent a49deb5ab1
commit b9146fbeac

View File

@ -47,7 +47,13 @@ define(
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
mockSubscription = jasmine.createSpyObj(
'subscription',
['unsubscribe', 'getTelemetryObjects', 'promiseTelemetryObjects']
[
'makeDatum',
'getDatum',
'unsubscribe',
'getTelemetryObjects',
'promiseTelemetryObjects'
]
);
mockDomainObject = jasmine.createSpyObj(
'domainObject',
@ -112,6 +118,20 @@ define(
expect(handle.getSeries(mockDomainObject))
.toEqual(mockSeries);
});
it("provides access to the datum objects by index", function () {
var testDatum = { a: 1, b: 2 }, testIndex = 42;
mockSubscription.makeDatum.andReturn(testDatum);
handle.request({});
expect(handle.getDatum(mockDomainObject, testIndex))
.toEqual(testDatum);
expect(mockSubscription.makeDatum)
.toHaveBeenCalledWith(
mockDomainObject,
mockSeries,
testIndex
);
});
});
}
);