const test = require('ava');
require('babel-register');
const Bemmer = require('../sources/bemmer.es6').default;

const TEST_INPUTS = [
  ['__zzz', { yyy: true }],
  ['__zzz__yyy', { xxx: true, www: false }],
  ['', { zzz: true }],
  ['__zzz'],
  ['__zzz_yyy', { xxx: true }],
  ['__zz!z$&y@yy', { xxx: true }],
  []
];

test('Bemmer.create() #1', t => {
  const b = Bemmer.create('aaa');
  const expected = [
    'aaa__zzz aaa__zzz--yyy',
    'aaa__zzz__yyy aaa__zzz__yyy--xxx',
    'aaa aaa--zzz',
    'aaa__zzz',
    'aaa__zzz_yyy aaa__zzz_yyy--xxx',
    'aaa__zz!z$&y@yy aaa__zz!z$&y@yy--xxx',
    'aaa'
  ];

  t.plan(TEST_INPUTS.length);

  TEST_INPUTS.forEach((input, i) => {
    t.is(b(...input), expected[i]);
  });
});

test('Bemmer.create() #2', t => {
  const b = Bemmer.create('aaa__bbb--ccc');
  const expected = [
    'aaa__bbb__zzz aaa__bbb__zzz--ccc aaa__bbb__zzz--yyy',
    'aaa__bbb__zzz__yyy aaa__bbb__zzz__yyy--ccc aaa__bbb__zzz__yyy--xxx',
    'aaa__bbb aaa__bbb--ccc aaa__bbb--zzz',
    'aaa__bbb__zzz aaa__bbb__zzz--ccc',
    'aaa__bbb__zzz_yyy aaa__bbb__zzz_yyy--ccc aaa__bbb__zzz_yyy--xxx',
    'aaa__bbb__zz!z$&y@yy aaa__bbb__zz!z$&y@yy--ccc aaa__bbb__zz!z$&y@yy--xxx',
    'aaa__bbb aaa__bbb--ccc'
  ];

  t.plan(TEST_INPUTS.length);

  TEST_INPUTS.forEach((input, i) => {
    t.is(b(...input), expected[i]);
  });
});

test('Bemmer.create() #3', t => {
  const b = Bemmer.create('aaa__bbb ccc');
  const expected = [
    'aaa__bbb__zzz aaa__bbb__zzz--yyy ccc__zzz ccc__zzz--yyy',
    'aaa__bbb__zzz__yyy aaa__bbb__zzz__yyy--xxx ccc__zzz__yyy ccc__zzz__yyy--xxx',
    'aaa__bbb aaa__bbb--zzz ccc ccc--zzz',
    'aaa__bbb__zzz ccc__zzz',
    'aaa__bbb__zzz_yyy aaa__bbb__zzz_yyy--xxx ccc__zzz_yyy ccc__zzz_yyy--xxx',
    'aaa__bbb__zz!z$&y@yy aaa__bbb__zz!z$&y@yy--xxx ccc__zz!z$&y@yy ccc__zz!z$&y@yy--xxx',
    'aaa__bbb ccc'
  ];

  t.plan(TEST_INPUTS.length);

  TEST_INPUTS.forEach((input, i) => {
    t.is(b(...input), expected[i]);
  });
});

test('Bemmer.create() #4', t => {
  const b = Bemmer.create('aaa__bbb aaa__bbb--ccc ddd ddd--ccc');
  const expected = [
    'aaa__bbb__zzz aaa__bbb__zzz--yyy aaa__bbb__zzz--ccc ddd__zzz ddd__zzz--yyy ddd__zzz--ccc',
    'aaa__bbb__zzz__yyy aaa__bbb__zzz__yyy--xxx aaa__bbb__zzz__yyy--ccc ddd__zzz__yyy ddd__zzz__yyy--xxx ddd__zzz__yyy--ccc',
    'aaa__bbb aaa__bbb--zzz aaa__bbb--ccc ddd ddd--zzz ddd--ccc',
    'aaa__bbb__zzz aaa__bbb__zzz--ccc ddd__zzz ddd__zzz--ccc',
    'aaa__bbb__zzz_yyy aaa__bbb__zzz_yyy--xxx aaa__bbb__zzz_yyy--ccc ddd__zzz_yyy ddd__zzz_yyy--xxx ddd__zzz_yyy--ccc',
    'aaa__bbb__zz!z$&y@yy aaa__bbb__zz!z$&y@yy--xxx aaa__bbb__zz!z$&y@yy--ccc ddd__zz!z$&y@yy ddd__zz!z$&y@yy--xxx ddd__zz!z$&y@yy--ccc',
    'aaa__bbb aaa__bbb--ccc ddd ddd--ccc'
  ];

  t.plan(TEST_INPUTS.length);

  TEST_INPUTS.forEach((input, i) => {
    t.is(b(...input), expected[i]);
  });
});

@@ -55,17 +55,17 @@
 ;%0Aconst 
-B
+b
 emmer = 
@@ -87,29 +87,10 @@
 rces
-/bemmer.es6').default
+')
 ;%0A%0Ac
@@ -293,33 +293,33 @@
 %0A  %5B%5D%0A%5D;%0A%0Atest('
-B
+b
 emmer.create() #
@@ -310,24 +310,31 @@
 emmer.create
+Builder
 () #1', t =%3E
@@ -340,33 +340,33 @@
 %3E %7B%0A  const b = 
-B
+b
 emmer.create('aa
@@ -357,24 +357,31 @@
 emmer.create
+Builder
 ('aaa');%0A  c
@@ -716,33 +716,33 @@
  %7D);%0A%7D);%0A%0Atest('
-B
+b
 emmer.create() #
@@ -733,24 +733,31 @@
 emmer.create
+Builder
 () #2', t =%3E
@@ -763,33 +763,33 @@
 %3E %7B%0A  const b = 
-B
+b
 emmer.create('aa
@@ -776,32 +776,39 @@
  = bemmer.create
+Builder
 ('aaa__bbb--ccc'
@@ -1348,33 +1348,33 @@
  %7D);%0A%7D);%0A%0Atest('
-B
+b
 emmer.create() #
@@ -1365,24 +1365,31 @@
 emmer.create
+Builder
 () #3', t =%3E
@@ -1395,33 +1395,33 @@
 %3E %7B%0A  const b = 
-B
+b
 emmer.create('aa
@@ -1408,32 +1408,39 @@
  = bemmer.create
+Builder
 ('aaa__bbb ccc')
@@ -1998,17 +1998,17 @@
 %0A%0Atest('
-B
+b
 emmer.cr
@@ -2011,16 +2011,23 @@
 r.create
+Builder
 () #4', 
@@ -2045,17 +2045,17 @@
 nst b = 
-B
+b
 emmer.cr
@@ -2058,16 +2058,23 @@
 r.create
+Builder
 ('aaa__b

Modify tests