[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']); mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
mockSubscription = jasmine.createSpyObj( mockSubscription = jasmine.createSpyObj(
'subscription', 'subscription',
['unsubscribe', 'getTelemetryObjects', 'promiseTelemetryObjects'] [
'makeDatum',
'getDatum',
'unsubscribe',
'getTelemetryObjects',
'promiseTelemetryObjects'
]
); );
mockDomainObject = jasmine.createSpyObj( mockDomainObject = jasmine.createSpyObj(
'domainObject', 'domainObject',
@ -112,6 +118,20 @@ define(
expect(handle.getSeries(mockDomainObject)) expect(handle.getSeries(mockDomainObject))
.toEqual(mockSeries); .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
);
});
}); });
} }
); );