mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 23:12:23 +00:00
[Time Conductor] Update telemetryFormatter spec
This commit is contained in:
parent
920c83771d
commit
f30a2dd791
@ -27,16 +27,35 @@ define(
|
||||
"use strict";
|
||||
|
||||
describe("The telemetry formatter", function () {
|
||||
var formatter;
|
||||
var mockFormatService,
|
||||
mockFormat,
|
||||
formatter;
|
||||
|
||||
beforeEach(function () {
|
||||
formatter = new TelemetryFormatter();
|
||||
mockFormatService =
|
||||
jasmine.createSpyObj("formatService", ["getFormat"]);
|
||||
mockFormat = jasmine.createSpyObj("format", [
|
||||
"validate",
|
||||
"parse",
|
||||
"format"
|
||||
]);
|
||||
mockFormatService.getFormat.andReturn(mockFormat);
|
||||
formatter = new TelemetryFormatter(mockFormatService);
|
||||
});
|
||||
|
||||
it("formats domains using YYYY-DDD style", function () {
|
||||
expect(formatter.formatDomainValue(402513731000)).toEqual(
|
||||
"1982-276 17:22:11"
|
||||
);
|
||||
it("formats domains using the formatService", function () {
|
||||
var testValue = 12321, testResult = "some result";
|
||||
mockFormat.format.andReturn(testResult);
|
||||
|
||||
expect(formatter.formatDomainValue(testValue))
|
||||
.toEqual(testResult);
|
||||
expect(mockFormat.format).toHaveBeenCalledWith(testValue);
|
||||
});
|
||||
|
||||
it("passes format keys to the formatService", function () {
|
||||
formatter.formatDomainValue(12321, "someKey");
|
||||
expect(mockFormatService.getFormat)
|
||||
.toHaveBeenCalledWith("someKey");
|
||||
});
|
||||
|
||||
it("formats ranges as values", function () {
|
||||
@ -44,4 +63,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user