before('before', function (assert) { reset(function (status) { console.log(status); request.post("/api/v1/auth/token") .send({"email": "admin", "password": "1234"}) .expect('Content-Type', /json/) .end(function (err, res) { assert.error(err, "token request made") token = res.body.token; baseHeaders = { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "JWT " + token }; assert.end(); }) }) });
test('client.search with callback', function userLandCode (t) { resetAgent(done(t, 'POST', '/_search', '{"q":"pants"}')) agent.startTransaction('foo') var client = new elasticsearch.Client({ host: host }) var query = { q: 'pants' } client.search(query, function (err) { t.error(err) agent.endTransaction() agent.flush() }) })
test('Command line: webtorrent download <torrent file> (with local content)', t => { t.plan(2) const fixturesPath = path.join(path.dirname(require.resolve('webtorrent-fixtures')), 'fixtures') cp.exec(`${CMD} download ${fixtures.leaves.torrentPath} --out ${fixturesPath}`, (err, data) => { t.error(err) t.ok(data.includes('successfully')) }) })
test('should delegate fetchOtaInfo to executable', t => { var delegate = new Delegation([ '--fetcher', `${process.argv[0]} ${path.resolve(__dirname, 'fixture/fetcher.js')}` ]) delegate.fetchOtaInfo('foobar', (err, result) => { t.error(err) t.deepEqual(result, { imageUrl: 'https://example.com', version: '2.3.3', integrity: 'foobar' }) t.end() }) })
test('Command line: webtorrent info magnet_uri', t => { t.plan(2) const leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.example.com%2Fannounce&tr=http%3A%2F%2Ftracker.example2.com%2Fannounce&tr=udp%3A%2F%2Ftracker.example3.com%3A3310%2Fannounce&tr=udp%3A%2F%2Ftracker.example4.com%3A80&tr=udp%3A%2F%2Ftracker.example5.com%3A80&tr=udp%3A%2F%2Ftracker.example6.com%3A80' cp.exec(`${CMD} info "${leavesMagnetURI}"`, (err, data) => { t.error(err) data = JSON.parse(data) const parsedTorrent = parseTorrent(leavesMagnetURI) delete parsedTorrent.infoHashBuffer t.deepEqual(data, JSON.parse(JSON.stringify(parsedTorrent, undefined, 2))) }) })
test('api usage', function (t) { t.plan(3) healthier.lintFiles([], { cwd: path.join(__dirname, '../bin') }, function (err, result) { t.error(err, 'no error while linting') t.equal(typeof result, 'object', 'result is an object') t.equal(result.errorCount, 0, 'no errors') }) })
test('[ AVRGIRL-ARDUINO ] ::listPorts (prototype)', function(t) { t.plan(3); var a = new Avrgirl(DEF_OPTS2); a.listPorts(function(error, ports) { t.ok(ports.length, 'got a list of ports'); t.ok(ports[2]._standardPid, 'added _standardPid property'); t.error(error, 'no error on listing'); }); });
test('[ AVRGIRL-ARDUINO ] ::listPorts', function(t) { t.plan(3); Avrgirl.listPorts(function(error, ports) { t.ok(ports.length, 'got a list of ports'); t.ok(ports[2]._standardPid, 'added _standardPid property'); t.error(error, 'no error on listing'); }); });
test('should break', t => { t.plan(2) compose([ cb => compose.Break(123), cb => t.fail('unreachable path') ], (err, res) => { t.error(err) t.strictEqual(res, 123) t.end() }) })
test('client.ping with promise', function userLandCode (t) { resetAgent(done(t, 'HEAD', '/')) agent.startTransaction('foo') var client = new elasticsearch.Client({ host: host }) client.ping().then(function () { agent.endTransaction() agent.flush() }, function (err) { t.error(err) }) })
test('should fetch image size', t => { t.plan(2) wget.fetchImageSize('http://example.com', (err, imageSize) => { t.error(err) t.ok(Number.isInteger(imageSize)) }) })
test('[ AVRGIRL-ARDUINO ] ::_validateBoard (SPARSE)', function(t) { t.plan(1); var a = new Avrgirl({ board: { name: DEF_OPTS2.board } }); a._validateBoard(function(error) { t.error(error, 'no error'); }); });
test('[ AVRGIRL-ARDUINO ] ::_validateBoard (GOOD)', function(t) { t.plan(1); var a = new Avrgirl(DEF_OPTS2); a._validateBoard(function(error) { t.error(error, 'no error'); }); });
test('client.ping with callback', function userLandCode (t) { resetAgent(done(t, 'HEAD', '/')) agent.startTransaction('foo') var client = new elasticsearch.Client({ host: host }) client.ping(function (err) { t.error(err) agent.endTransaction() agent.flush() }) })
test('client.count with callback', function userLandCode (t) { resetAgent(done(t, 'POST', '/_count')) agent.startTransaction('foo') var client = new elasticsearch.Client({ host: host }) client.count(function (err) { t.error(err) agent.endTransaction() agent.flush() }) })