test('suite', function (t) { t.ok(true, 'yeah') t.ok(false, 'WOOPS') t.fail(false) t.end() })
test('fetchChangelogBody(<version>)', (t) => { const releasePost = require('../../scripts/release-post') const changelogFixture = path.resolve(__dirname, 'CHANGELOG.fixture.md') t.test('does not include `## header` in matched version section', (t) => { const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) releasePost.fetchChangelogBody('4.1.0').then((body) => { t.true(body.startsWith('### Notable changes')) t.true(github.isDone(), 'githubusercontent.com was requested') t.end() }, t.fail) }) t.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('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() })
test('session start timeout', function (t) { t.plan(2) let output = '' const session = new BrowserSession('abc', 200, '.') session.on('data', function (s) { output += s }) session.on('complete', function (stats) { t.fail('should not complete') }) session.on('error', function (err) { t.is(err.message, 'Did not receive output from \'abc\' (0.2 seconds)') session.on('close', function () { t.same(output, '') }) }) })
context.createSession(function (session) { session.on('close', () => t.pass('session closed')) session.on('complete', () => t.fail('session should not complete')) context.destroy(new Error('test')) }) context.createSession(function (session) { session.on('close', () => t.pass('session closed')) session.on('complete', () => t.fail('session should not complete')) session.destroy(new Error('test')) })
}, t.fail) })
test('can call the api', t=> { slack({test:'hello world'}, (err, res)=> { if (err) { t.fail(err, err) } else { t.ok(res, 'gotta response') console.log(res) } t.end() }) })
test('promise', t=> { t.plan(1) let token = process.env.SLACK_BOT_TOKEN let bot = new Slack({token}) bot.api.test({a:1}).then(function(data) { t.ok(data, 'promised called') console.log(data) }).catch(function(err) { t.fail(err, 'promised fails') console.error(err) }) })
test('can get team info', t=> { t.plan(1) slack.auth.test({}).then(function(data) { t.fail(data, 'got data') console.log(data) }).catch(function(err) { t.ok(err, 'failed correctly') console.log(err) }) })
test('session output timeout', function (t) { t.plan(2) let output = '' const session = new BrowserSession('abc', 200, '.') session.on('data', function (s) { output += s }) session.on('complete', function (stats) { t.fail('should not complete') }) session.on('error', function (err) { t.is(err.message, 'Did not receive output from \'abc\' (0.2 seconds)') session.on('close', function () { t.same(output, 'TAP version 13\n# abc [3]\n') }) }) session.write({ type: 'console', level: 'log', args: ['TAP version 13'] }) })
test('can call client', t=> { t.plan(1) client.users.list({}, function __list(err, result) { if (err) { t.fail(err) } else { t.ok(result) console.log(result) } }) })