import test from 'tape';
import string from './string';

test(`\`string)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0), TypeError,
    `Failed no argument.`);
  assert.end();
});

test(`\`stringundefined)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0, void 0), TypeError,
    `Failed \`undefined\`.`);
  assert.end();
});

test(`\`stringnull)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0, null), TypeError,
    `Failed \`null\`.`);
  assert.end();
});

test(`\`stringFunction)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0, () => {}), TypeError,
    `Failed \`Function\`.`);
  assert.end();
});

test(`\`stringString)\` returns \`String\``, (assert) => {
  const value = `a string`;
  assert.equal(string(value), value,
    `Failed \`String\`.`);
  assert.end();
});

test(`\`stringObject)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0, {}), TypeError,
    `Failed \`Object\`.`);
  assert.end();
});

test(`\`stringBoolean)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0, true), TypeError,
    `Failed \`true\`.`);
  assert.throws(string.bind(void 0, false), TypeError,
    `Failed \`false\`.`);
  assert.end();
});

test(`\`stringNumber)\` throws \`TypeError\``, (assert) => {
  assert.throws(string.bind(void 0, 0), TypeError,
    `Failed \`0\`.`);
  assert.throws(string.bind(void 0, 1), TypeError,
    `Failed \`1\`.`);
  assert.throws(string.bind(void 0, 2), TypeError,
    `Failed \`2\`.`);
  assert.throws(string.bind(void 0, 123), TypeError,
    `Failed \`123\`.`);
  assert.throws(string.bind(void 0, -123), TypeError,
    `Failed \`-123\`.`);
  assert.throws(string.bind(void 0, 123.4567), TypeError,
    `Failed \`123.4567\`.`);
  assert.end();
});

@@ -60,24 +60,25 @@
 st(%60%5C%60string
+(
 )%5C%60 throws %5C
@@ -98,32 +98,32 @@
 , (assert) =%3E %7B%0A
-
   assert.throws(
@@ -217,16 +217,17 @@
 %5C%60string
+(
 undefine
@@ -389,16 +389,17 @@
 %5C%60string
+(
 null)%5C%60 
@@ -549,16 +549,17 @@
 %5C%60string
+(
 Function
@@ -721,16 +721,17 @@
 %5C%60string
+(
 String)%5C
@@ -894,16 +894,17 @@
 %5C%60string
+(
 Object)%5C
@@ -1056,16 +1056,17 @@
 %5C%60string
+(
 Boolean)
@@ -1278,32 +1278,32 @@
 ert.end();%0A%7D);%0A%0A
-
 test(%60%5C%60stringNu
@@ -1300,16 +1300,17 @@
 %5C%60string
+(
 Number)%5C

fix typos in string messages.