mirror of
https://github.com/nasa/openmct.git
synced 2025-05-11 13:03:03 +00:00
[Time Conductor] Add test cases
...to cover FormatProvider.
This commit is contained in:
parent
e80d094174
commit
00c0019122
@ -26,7 +26,35 @@ define(
|
|||||||
function (FormatProvider) {
|
function (FormatProvider) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var KEYS = [ 'a', 'b', 'c' ];
|
||||||
|
|
||||||
describe("The FormatProvider", function () {
|
describe("The FormatProvider", function () {
|
||||||
|
var mockFormats,
|
||||||
|
mockFormatInstances,
|
||||||
|
provider;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
mockFormatInstances = KEYS.map(function (k) {
|
||||||
|
return jasmine.createSpyObj(
|
||||||
|
'format-' + k,
|
||||||
|
[ 'parse', 'validate', 'format' ]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
// Return constructors
|
||||||
|
mockFormats = KEYS.map(function (k, i) {
|
||||||
|
function MockFormat() { return mockFormatInstances[i]; }
|
||||||
|
MockFormat.key = k;
|
||||||
|
return MockFormat;
|
||||||
|
});
|
||||||
|
provider = new FormatProvider(mockFormats);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("looks up formats by key", function () {
|
||||||
|
KEYS.forEach(function (k, i) {
|
||||||
|
expect(provider.getFormat(k))
|
||||||
|
.toEqual(mockFormatInstances[i]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user