[Spec] Update API mock

Update telemetry api mock to return proper value formatters.
This commit is contained in:
Pete Richards 2017-04-27 11:20:25 -07:00
parent 5db03bb1bd
commit 2b41321c03

View File

@ -101,7 +101,21 @@ define(
]);
mockTelemetryAPI.commonValuesForHints.andReturn([]);
mockTelemetryAPI.request.andReturn(Promise.resolve([]));
mockTelemetryAPI.getValueFormatter.andCallFake(function (metadata) {
var formatter = jasmine.createSpyObj(
'telemetryFormatter:' + metadata.key,
[
'format',
'parse'
]
);
var getter = function (datum) {
return datum[metadata.key];
};
formatter.format.andCallFake(getter);
formatter.parse.andCallFake(getter);
return formatter;
});
mockTelemetryAPI.canProvideTelemetry.andReturn(false);