test('session unknown message', function (t) { t.plan(2) const session = new BrowserSession('abc', 30e3, '.') session.on('error', function (err) { t.is(err.message, 'Unknown message type') }) session.on('close', function () { t.pass('closed') }) session.resume() session.write({ type: 'foo' }) })
// https://github.com/defunctzombie/zuul/issues/145 test('ok', function (t) { t.pass() t.end() })
files.filter((file) => /\.md$/.test(file)).forEach((file) => { const strings = {}; let content = fs.readFileSync(path.join("./test", file), utf8Encoding); while (content) { strings[content.length.toString()] = content; content = content.slice(0, -1); } tape(`type ${file}`, (test) => { test.plan(1); markdownlint.sync({ // @ts-ignore strings, "resultVersion": 0 }); test.pass(); test.end(); }); });
test('timeout', function (t) { t.plan(5) t.notOk(timeout.optional(function () { t.fail('should not be called') }, 0)) t.notOk(timeout.optional(function () { t.fail('should not be called') }, -1)) t.notOk(timeout.optional(function () { t.fail('should not be called') }, Infinity)) t.ok(timeout.optional(function () { t.pass() }, 1)) })
test('message server closes connection without valid cid', function (t) { t.plan(3) const server = new MessageServer() server.open(function (err) { t.ifError(err, 'no open error') const socket = engineClient(`ws://localhost:${server.port}`, { path: '/airtap/msg' }) socket.on('close', function () { t.pass('closed') server.close(function (err) { t.ifError(err, 'no close error') }) }) }) })
test('destroy test', function (t) { t.plan(2) const test = new Test() test.on('complete', function () { t.fail('should not be called') }) test.on('error', function (err) { t.is(err.message, 'test') test.on('close', function () { t.pass('closed') }) }) test.destroy(new Error('test')) test.complete() })
t.pass('emits plugin warning if no source files'); t.ok(/source files/i.test(obj.warning), 'informs user with message');
session.on('close', () => t.pass('session closed')) session.on('complete', () => t.fail('session should not complete')) context.destroy(new Error('test')) session.on('close', () => t.pass('session closed')) session.on('complete', () => t.fail('session should not complete')) session.destroy(new Error('test')) if (expectClose) t.pass('browser closed') callback()
test('required fields', function (t) { t.plan(6) t.throws(createServer.bind(null), TypeError, 'options are required') t.throws(createServer.bind(null, { agreeTos: true }), /Email is required/, 'email is required') t.throws(createServer.bind(null, { email: 'a@b.com' }), /Must agree to LE TOS/, 'tos is required') t.throws(createServer.bind(null, { agreeTos: true, email: 'a@b.com' }), /Domains option must be an array or a function/, 'domains is required') t.throws(createServer.bind(null, { agreeTos: true, email: 'a@b.com', domains: [] }), /You must specify at least one domain/, 'domains is required') createServer({ email: 'a@b.com', agreeTos: true, domains: ['localhost'], // We only use ports here to avoid EACCES. ports: { http: 3000, https: 3001 } }) .once('error', t.fail) .once('listening', function () { this.close() t.pass('server should start') }) })
test('simple app integration', t => { t.plan(1) var api = new EventEmitter() api.appHome = path.join(__dirname, './fixture/simple-app') global[Symbol.for('yoda#api')] = api api.exit = () => { t.pass('integration done') } require('./fixture/simple-app/app') api.emit('url', 'yoda-app://foo') t.end() })
test('should skip path if not exist', t => { t.plan(1) var runtime = {} var loader = new Loader(runtime, 'component') loader.load(path.join(__dirname, 'does-not-exist')) t.pass() })
test('pass', function (t) { t.pass() t.end() })