[Duplicate] Add test case

Add test case for single-element string arrays, to
replicate bug around type coercion.

https://github.com/nasa/openmctweb/issues/444
This commit is contained in:
Victor Woeltjen 2015-12-17 15:07:16 -08:00
parent 82e4a53472
commit 995d71f901

View File

@ -106,7 +106,8 @@ define(
composition: [ ID_A, ID_B ], composition: [ ID_A, ID_B ],
someObj: {}, someObj: {},
someArr: [ ID_A, ID_B ], someArr: [ ID_A, ID_B ],
objArr: [{"id": ID_A}, {"id": ID_B}] objArr: [{"id": ID_A}, {"id": ID_B}],
singleElementArr: [ ID_A ]
}; };
testModel.someObj[ID_A] = "some value"; testModel.someObj[ID_A] = "some value";
testModel.someObj.someProperty = ID_B; testModel.someObj.someProperty = ID_B;
@ -181,6 +182,13 @@ define(
expect(model.someObj[cloneIds[ID_A]]) expect(model.someObj[cloneIds[ID_A]])
.toEqual(testModel.someObj[ID_A]); .toEqual(testModel.someObj[ID_A]);
}); });
it("contain rewritten identifiers in single-element arrays", function () {
expect(model.singleElementArr)
.toEqual(testModel.singleElementArr.map(function (id) {
return cloneIds[id];
}));
});
}); });
describe("copies object trees with multiple references to the" + describe("copies object trees with multiple references to the" +