const test = require('tape');
const parse = require('../../src/lib/parse');

test('parse: "look"', t => {
  const value = 'look';
  const expected = {
    verb: 'look',
    dobjstr: void 0,
    prepstr: void 0,
    iobjstr: void 0,
    argstr: '',
  };
  const actual = parse(value);

  t.deepEqual(actual, expected);
  t.end();
});

test('parse: "take yellow bird"', t => {
  const value = 'take yellow bird';
  const expected = {
    verb: 'take',
    dobjstr: 'yellow bird',
    prepstr: void 0,
    iobjstr: void 0,
    argstr: 'yellow bird',
  };
  const actual = parse(value);

  t.deepEqual(actual, expected);
  t.end();
});

test('parse: "put yellow bird in cuckoo clock"', t => {
  const value = 'put yellow bird in cuckoo clock';
  const expected = {
    verb: 'put',
    dobjstr: 'yellow bird',
    prepstr: 'in',
    iobjstr: 'cuckoo clock',
    argstr: 'yellow bird in cuckoo clock',
  };
  const actual = parse(value);

  t.deepEqual(actual, expected);
  t.end();
});

test('parse: "look at"', t => {
  const value = 'look at';
  const expected = {
    verb: 'look',
    dobjstr: void 0,
    prepstr: 'at',
    iobjstr: void 0,
    argstr: 'at',
  };
  const actual = parse(value);

  t.deepEqual(actual, expected);
  t.end();
});

@@ -67,16 +67,90 @@
 /parse')
+.parseSentence;%0Aconst parseNoun = require('../../src/lib/parse').parseNoun
 ;%0A%0Atest(
@@ -1292,28 +1292,1683 @@
 , expected);%0A  t.end();%0A%7D);%0A
+%0Atest('parseNoun: %22any book%22', t =%3E %7B%0A  const value = 'any book';%0A  const expected = %5B'any', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22a book%22', t =%3E %7B%0A  const value = 'a book';%0A  const expected = %5B'any', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22any book%22', t =%3E %7B%0A  const value = 'any book';%0A  const expected = %5B'any', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22book%22', t =%3E %7B%0A  const value = 'book';%0A  const expected = %5Bvoid 0, 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22the book%22', t =%3E %7B%0A  const value = 'the book';%0A  const expected = %5Bvoid 0, 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %221.book%22', t =%3E %7B%0A  const value = '1.book';%0A  const expected = %5B'1', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22book.1%22', t =%3E %7B%0A  const value = 'book.1';%0A  const expected = %5B'1', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22book 1%22', t =%3E %7B%0A  const value = 'book 1';%0A  const expected = %5B'1', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A%0Atest('parseNoun: %22all book%22', t =%3E %7B%0A  const value = 'all book';%0A  const expected = %5B'all', 'book'%5D;%0A%0A  const actual = parseNoun(value);%0A%0A  t.deepEqual(actual, expected);%0A  t.end();%0A%7D);%0A

Fix tests for parse + add new tests for the noun/determiner parsing