it('should support the options argument', function () { const options = { paths: [path.join(process.cwd(), 'test', 'src', 'bar')] } const baz = require.resolve('./baz', options) expect(baz).to.have.string(path.join('bar', 'baz', 'index.js')) })
it('fails to parse a hosts file with an entry of a non-string password', function() { var hosts = cli.parseHosts(__dirname + "/../../fixtures/cli/fake-hosts.invalid-4.json"); expect(hosts.error).to.exist; expect(hosts.error).to.have.string("INVALID: an entry's password is not a string"); });
it('includeHeaders', () => { jsonexport([{ a: true }, { a: false }], { includeHeaders: false }, (err, csv) => { expect(csv).to.have.string(`true${os.EOL}false`); }); });
it('should include partial on layout', function() { // when nanogen.build(mockConfig); // then const page1 = fse.readFileSync( `${mockConfig.build.outputPath}/ejs1/index.html`, 'utf-8' ); expect(page1).to.have.string('<p>test-partial-from-layout</p>'); });
it('textDelimiter with linebreak', () => { jsonexport({ a: '\n', b: true }, { textDelimiter: '|' }, (err, csv) => { expect(csv).to.have.string('|\n|'); }); });
it('endOfLine', () => { jsonexport({ a: true, b: true }, { endOfLine: '|' }, (err, csv) => { expect(csv).to.have.string('a,true|b,true'); }); });
it('booleanTrueString', () => { jsonexport({ a: true, b: true }, { booleanTrueString: 'test' }, (err, csv) => { expect(csv).to.have.string('a,test'); }); });
it('mapHeaders', () => { jsonexport([{ a: true, b: false }], { mapHeaders: h => `${h}|||` }, (err, csv) => { expect(csv).to.have.string('a|||'); }); });
it('fails to parse a hosts file with non-object entry', function() { var hosts = cli.parseHosts(__dirname + "/../../fixtures/cli/fake-hosts.invalid-1.json"); expect(hosts.error).to.exist; expect(hosts.error).to.have.string('INVALID: an entry in hosts file is not an object'); });
it('fails to parse a hosts file with an entry of a non-number port', function() { var hosts = cli.parseHosts(__dirname + "/../../fixtures/cli/fake-hosts.invalid-3.json"); expect(hosts.error).to.exist; expect(hosts.error).to.have.string("INVALID: an entry's port number is not a number!"); });
it('rowDelimiter', () => { jsonexport({ a: true, b: true }, { rowDelimiter: '|' }, (err, csv) => { expect(csv).to.have.string('a|true'); }); });
it('fails to parse a non-json hosts file', function() { var hosts = cli.parseHosts(__dirname + "/cli.specs.js"); expect(hosts.error).to.exist; expect(hosts.error).to.have.string('Unexpected token'); });
it('headerPathString', () => { jsonexport({ a: { b: true } }, { headerPathString: '|' }, (err, csv) => { expect(csv).to.have.string('a|b'); }); });