[Time Conductor] Update telemetryFormatter spec

This commit is contained in:
Victor Woeltjen 2015-10-27 15:37:08 -07:00
parent 920c83771d
commit f30a2dd791

View File

@ -27,16 +27,35 @@ define(
"use strict"; "use strict";
describe("The telemetry formatter", function () { describe("The telemetry formatter", function () {
var formatter; var mockFormatService,
mockFormat,
formatter;
beforeEach(function () { 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 () { it("formats domains using the formatService", function () {
expect(formatter.formatDomainValue(402513731000)).toEqual( var testValue = 12321, testResult = "some result";
"1982-276 17:22:11" 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 () { it("formats ranges as values", function () {