Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculate file downloaded correctly #1479

Merged
merged 3 commits into from Aug 24, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Added test for file.downloaded

  • Loading branch information
jimmywarting committed Aug 24, 2018
commit baed9c5ba70db2d37ba9d326c885c2082633a9f0
@@ -112,7 +112,7 @@ test('client.seed: filesystem path to folder with one file, string', function (t
})

test('client.seed: filesystem path to folder with multiple files, string', function (t) {
t.plan(6)
t.plan(7)

var client = new WebTorrent({ dht: false, tracker: false })

@@ -124,6 +124,17 @@ test('client.seed: filesystem path to folder with multiple files, string', funct
t.equal(torrent.infoHash, fixtures.numbers.parsedTorrent.infoHash)
t.equal(torrent.magnetURI, fixtures.numbers.magnetURI)

const downloaded = torrent.files.map(file => ({
length: file.length,
downloaded: file.downloaded
}))

t.deepEqual(downloaded, [
{ length: 1, downloaded: 1 },
{ length: 2, downloaded: 2 },
{ length: 3, downloaded: 3 }
], 'expected downloaded to be calculated correctly')

client.remove(torrent, function (err) { t.error(err, 'torrent destroyed') })
t.equal(client.torrents.length, 0)

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.