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

Issue 163 #525

Closed
wants to merge 7 commits into from
Closed

Issue 163 #525

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

More tests, more styling

  • Loading branch information
Aram Drevekenin
Aram Drevekenin committed Dec 12, 2015
commit 56b65d897a235b1ea1a8890ffc87ac570d394924
@@ -304,8 +304,8 @@ WebTorrent.prototype.destroy = function (cb) {
* @param {Number} rate
*/
WebTorrent.prototype.throttleDownload = function (rate) {
if (!Number(rate)) return
var self = this
if (!Number(rate)) return
self.downloadThrottleRate = rate
self.throttleGroups.down = new ThrottleGroup({rate: rate})
self.torrents.forEach(function (torrent) {
@@ -16,3 +16,19 @@ test('client download/upload throttle setting and rate reporting', function (t)
client.destroy()
t.end()
})

test('client download/upload throttle setting bad values', function (t) {
var client = new WebTorrent({ dht: false, tracker: false })

client.on('error', function (err) { t.fail(err) })
client.on('warning', function (err) { t.fail(err) })

client.throttleDownload("I'm a string")
client.throttleUpload(NaN)

t.equal(client.downloadThrottleRate, undefined)
t.equal(client.uploadThrottleRate, undefined)

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