I am trying to map each columnValue to the columnValues and each typeIds to a typeId. However when I map them one at a time the 2nd mapping is overriding the first one instead of mapping both of them. I console logged it out and the first array index looked like this
0:
typeId: 1
columnValues: []
It should look like this:
0:
typeId: 1
columnValues: Array(2)
0: "test1"
1: undefined
My test looks like this
[
{
columnValue: ['test1', undefined],
typeIds: [1, 2],
result: true,
},
{
columnValue: ['test2'],
typeIds: [3],
result: false,
},
{
columnValue: [undefined, 'test3'],
typeIds: [4, 5],
result: true,
},
{
columnValue: [],
typeIds: [],
result: false,
},
].forEach(({ columnValue, typeIds, result }) => {
fit(`when a plate layout has a columnValue of [${columnValue}], return ${result}`, () => {
let arrays = [columnValue].map((columnValues) =>
array({ columnValues }),
);
arrays = typeIds.map((typeId) =>
array({ typeId })
);
Is there a way to map both at the same time? I tried something like this but it isn't working because the syntax is off:
[
{
columnValue: ['test1', undefined],
typeIds: [1, 2],
result: true,
},
{
columnValue: ['test2'],
typeIds: [3],
result: false,
},
{
columnValue: [undefined, 'test3'],
typeIds: [4, 5],
result: true,
},
{
columnValue: [],
typeIds: [],
result: false,
},
].forEach(({ columnValue, typeIds, result }) => {
fit(`when a plate layout has a columnValue of [${columnValue}], return ${result}`, () => {
constarrays = ([columnValue], typeIds).map((columnValues, typeIds) =>
array({ columnValues, typeIds }),
);