[Timeline] Update specs for indexes instead of ids

This commit is contained in:
Victor Woeltjen
2016-05-25 12:32:44 -07:00
parent ba0d9a186b
commit 73b922facf
4 changed files with 28 additions and 21 deletions

View File

@@ -23,13 +23,20 @@
define(
['../../src/actions/ModeColumn'],
function (ModeColumn) {
var TEST_IDS = ['a', 'b', 'c', 'd', 'e', 'f']
describe("ModeColumn", function () {
var testIndex,
testIdMap,
column;
beforeEach(function () {
testIndex = 3;
column = new ModeColumn(testIndex);
testIdMap = TEST_IDS.reduce(function (map, id, index) {
map[id] = index;
return map;
}, {});
column = new ModeColumn(testIndex, testIdMap);
});
it("includes a one-based index in its name", function () {
@@ -48,15 +55,15 @@ define(
);
testModel = {
relationships: {
modes: ['a', 'b', 'c', 'd', 'e', 'f']
modes: TEST_IDS
}
};
mockDomainObject.getModel.andReturn(testModel);
});
it("returns a corresponding identifier", function () {
it("returns a corresponding value from the map", function () {
expect(column.value(mockDomainObject))
.toEqual(testModel.relationships.modes[testIndex]);
.toEqual(testIdMap[testModel.relationships.modes[testIndex]]);
});
it("returns nothing when relationships are exceeded", function () {