Skip to content

Commit

Permalink
fixup! fixup! wip
Browse files Browse the repository at this point in the history
  • Loading branch information
skad0 committed Oct 10, 2016
1 parent 7f559ee commit 914a777
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/convert/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ module.exports = function (decl) {
// add new mod
acc[modsAdditionIdx].elems[curElemIdx].mods.push(result.elems[0].mods[0]);
}
} else {
// create mods property
acc[modsAdditionIdx].elems[curElemIdx].mods = result.elems[0].mods[0];
}
}
} else if (entity.modName) {
Expand Down
27 changes: 27 additions & 0 deletions test/convert/v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,30 @@ test('must split elem mods of block', t => {
output
);
});

test('must split vals of elem mods', t => {
const input = [
{ entity: { block: 'block1' }, tech: null },
{ entity: { block: 'block1', elem: 'elem1', modName: 'mod1', modVal: 'val1' }, tech: null },
{ entity: { block: 'block1', elem: 'elem1', modName: 'mod1', modVal: 'val2' }, tech: null }
];
const output = [
{ name: 'block1' },
{
name: 'block1',
elems: [
{
name: 'elem1',
mods: [
{ name: 'mod1', vals: [{ name: 'val1' }, { name: 'val2' }] }
]
}
]
}
];

t.deepEqual(
convert(input, { format: 'v1' }),
output
);
});

0 comments on commit 914a777

Please sign in to comment.