Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axross committed Apr 13, 2016
1 parent 3251211 commit 40265b4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,27 @@ const TESTCASES = [
'aaa__zzz__111__xxx__222 aaa__zzz__111__xxx__222--333 aaa__zzz__111__xxx__222--vvv bbb__ccc__zzz__111__xxx__222 bbb__ccc__zzz__111__xxx__222--333 bbb__ccc__zzz__111__xxx__222--vvv',
],
},
{
classnames: ['aaa bbb__zzz', undefined],
expects: [
'aaa bbb__zzz',
'aaa__zzz bbb__zzz__zzz',
'aaa__zzz__yyy__xxx bbb__zzz__zzz__yyy__xxx',
'aaa aaa--zzz bbb__zzz bbb__zzz--zzz',
'aaa__zzz aaa__zzz--yyy bbb__zzz__zzz bbb__zzz__zzz--yyy',
'aaa__zzz__yyy aaa__zzz__yyy--xxx bbb__zzz__zzz__yyy bbb__zzz__zzz__yyy--xxx',
'aaa__zzz__yyy__xxx aaa__zzz__yyy__xxx--vvv aaa__zzz__yyy__xxx--uuu bbb__zzz__zzz__yyy__xxx bbb__zzz__zzz__yyy__xxx--vvv bbb__zzz__zzz__yyy__xxx--uuu',
'aaa__zzz__yyy__xxx aaa__zzz__yyy__xxx--uuu bbb__zzz__zzz__yyy__xxx bbb__zzz__zzz__yyy__xxx--uuu',
'aaa__zzz__111__xxx__222 aaa__zzz__111__xxx__222--333 aaa__zzz__111__xxx__222--vvv bbb__zzz__zzz__111__xxx__222 bbb__zzz__zzz__111__xxx__222--333 bbb__zzz__zzz__111__xxx__222--vvv',
],
},
];

TESTCASES.forEach((testcase, i) => {
const builder = createBuilder(...testcase.classnames);

ARGS.forEach((args, j) => {
const result = builder(...args);
const result = createBuilder(builder(...args))();

test(`builder() returns correct classname string #${i + 1}-${j + 1}`, t => {
t.is(result, testcase.expects[j]);
Expand Down

0 comments on commit 40265b4

Please sign in to comment.