/** * Utility to test if a given document is both a valid * node, and matches a fixture. * * @param {string} name - Filename of fixture. * @param {string} document - Source to validate. * @param {string} method - Method to use. */ function describeFixture(t, name, doc, method) { var nlcstA = english[method || 'parse'](doc); var nlcstB = englishNoPosition[method || 'parse'](doc); var fixture = require('./fixture/' + name); nlcstTest(nlcstA); nlcstTest(nlcstB); t.deepEqual(nlcstA, fixture, 'should match w/ position'); t.deepEqual(nlcstB, clean(fixture), 'should match w/o position'); }
// Utility to test if a given document is both a valid node, and matches a // fixture. function describeFixture(t, name, doc, method) { var nlcstA = latin[method || 'parse'](doc) var nlcstB = latinNoPosition[method || 'parse'](doc) var fixture = JSON.parse( fs.readFileSync(path.join(__dirname, 'fixture', name + '.json')) ) nlcstTest(nlcstA) nlcstTest(nlcstB) t.deepEqual(nlcstA, fixture, 'should match w/ position') t.deepEqual( nlcstB, removePosition(fixture, true), 'should match w/o position' ) }
t.doesNotThrow(function () { nlcstTest(retext().parse('Foo')); }, 'should return NLCST');