Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/node/server.js')
-rw-r--r--test/node/server.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/node/server.js b/test/node/server.js
index 2da0f60..1aaff7c 100644
--- a/test/node/server.js
+++ b/test/node/server.js
@@ -4,44 +4,44 @@ const get = require('simple-get')
const test = require('tape')
const WebTorrent = require('../../')
-test('torrent.createServer: programmatic http server', function (t) {
+test('torrent.createServer: programmatic http server', t => {
t.plan(9)
const client = new WebTorrent({ tracker: false, dht: false, lsd: false })
- client.on('error', function (err) { t.fail(err) })
- client.on('warning', function (err) { t.fail(err) })
+ client.on('error', err => { t.fail(err) })
+ client.on('warning', err => { t.fail(err) })
- client.add(fixtures.leaves.torrent, function (torrent) {
+ client.add(fixtures.leaves.torrent, torrent => {
t.pass('got "torrent" event')
const server = torrent.createServer()
- server.listen(0, function () {
+ server.listen(0, () => {
const port = server.address().port
- t.pass('server is listening on ' + port)
+ t.pass(`server is listening on ${port}`)
// Seeding after server is created should work
- torrent.load(fs.createReadStream(fixtures.leaves.contentPath), function (err) {
+ torrent.load(fs.createReadStream(fixtures.leaves.contentPath), err => {
t.error(err, 'loaded seed content into torrent')
})
- const host = 'http://localhost:' + port
+ const host = `http://localhost:${port}`
// Index page should list files in the torrent
- get.concat(host + '/', function (err, res, data) {
+ get.concat(`${host}/`, (err, res, data) => {
t.error(err, 'got http response for /')
data = data.toString()
- t.ok(data.indexOf('Leaves of Grass by Walt Whitman.epub') !== -1)
+ t.ok(data.includes('Leaves of Grass by Walt Whitman.epub'))
// Verify file content for first (and only) file
- get.concat(host + '/0', function (err, res, data) {
+ get.concat(`${host}/0`, (err, res, data) => {
t.error(err, 'got http response for /0')
t.deepEqual(data, fixtures.leaves.content)
- server.close(function () {
+ server.close(() => {
t.pass('server closed')
})
- client.destroy(function (err) {
+ client.destroy(err => {
t.error(err, 'client destroyed')
})
})