mirror of
https://github.com/nasa/openmct.git
synced 2025-04-22 10:01:18 +00:00
[Spec] update formatter mock, remove smelly test
Update the formatter mock to implement the expected methods, such that formatting occurs properly. Remove a test that was validating the execution of a method as this was smelly-- it's not the method that is important, it's the result (that couldn't be obtained without the method).
This commit is contained in:
parent
0434928f55
commit
5db03bb1bd
@ -30,7 +30,6 @@ define(
|
||||
var mockDomainObject,
|
||||
mockAPI,
|
||||
mockTelemetryAPI,
|
||||
mockTelemetryFormatter,
|
||||
table,
|
||||
mockModel;
|
||||
|
||||
@ -48,21 +47,27 @@ define(
|
||||
};
|
||||
});
|
||||
|
||||
mockTelemetryFormatter = jasmine.createSpyObj('telemetryFormatter',
|
||||
[
|
||||
'format'
|
||||
]);
|
||||
mockTelemetryFormatter.format.andCallFake(function (valueIn) {
|
||||
return valueIn;
|
||||
});
|
||||
|
||||
mockTelemetryAPI = jasmine.createSpyObj('telemetryAPI', [
|
||||
'getValueFormatter'
|
||||
]);
|
||||
mockAPI = {
|
||||
telemetry: mockTelemetryAPI
|
||||
};
|
||||
mockTelemetryAPI.getValueFormatter.andReturn(mockTelemetryFormatter);
|
||||
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;
|
||||
});
|
||||
|
||||
table = new Table(mockDomainObject, mockAPI);
|
||||
});
|
||||
@ -176,10 +181,6 @@ define(
|
||||
expect(rowValues['Range 1'].cssClass).toEqual("alarm-class");
|
||||
});
|
||||
|
||||
it("Uses telemetry formatter to appropriately format" +
|
||||
" telemetry values", function () {
|
||||
expect(mockTelemetryFormatter.format).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user