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

Test excessive Memory Usage #1211

Closed
wants to merge 5 commits into from
Closed
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

separate tests

  • Loading branch information
disarticulate committed Oct 25, 2017
commit bcb70cdf6cd3d51ce79cee4b254da0f4fb7ddf51
@@ -3,18 +3,10 @@ var test = require('tape')
var WebTorrent = require('../../')
var fs = require('fs')

var data = fs.readFileSync('test/browser/data/data2.3MB.base64')
var data = 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
var img = Buffer.from(data, 'base64')
img.name = 'img.png'

var data2 = fs.readFileSync('test/browser/data/data2.5MB.base64')
var img2 = Buffer.from(data2, 'base64')
img2.name = 'img2.png'

var data3 = fs.readFileSync('test/browser/data/data2.7MB.base64')
var img3 = Buffer.from(data3, 'base64')
img3.name = 'img3.png'

function verifyImage (t, err, elem) {
t.error(err)
t.ok(typeof elem.src === 'string')
@@ -122,17 +114,3 @@ test('WebTorrent.WEBRTC_SUPPORT', function (t) {
t.error(err, 'client destroyed')
})
})

test('seed Multiple Torrents', function (t) {
t.plan(3)
var client = new WebTorrent({ dht: false, tracker: false })
client.seed(img, function (torrent) {
t.equal(torrent.infoHash,'fe83c6629dc58cc08b7809256000ad068a167b95')
})
client.seed(img2, function (torrent) {
t.equal(torrent.infoHash, 'fd5c8c050571e1f8c369541ed5560f7696931e3f')
})
client.seed(img3, function (torrent) {
t.equal(torrent.infoHash,'2b12aaf42343ce8dc999cfe36a3da318b22bacf2')
})
})
@@ -0,0 +1,30 @@
var Buffer = require('safe-buffer').Buffer
var test = require('tape')
var WebTorrent = require('../../')
var fs = require('fs')

var data = fs.readFileSync('test/browser/data/data2.3MB.base64')
var img = Buffer.from(data, 'base64')
img.name = 'img.png'

var data2 = fs.readFileSync('test/browser/data/data2.5MB.base64')
var img2 = Buffer.from(data2, 'base64')
img2.name = 'img2.png'

var data3 = fs.readFileSync('test/browser/data/data2.5MB.base64')
var img3 = Buffer.from(data3, 'base64')
img3.name = 'img3.png'

test('seed Multiple Torrents', function (t) {
t.plan(3)
var client = new WebTorrent({ dht: false, tracker: false })
client.seed(img, function (torrent) {
t.equal(torrent.infoHash,'fe83c6629dc58cc08b7809256000ad068a167b95')
})
client.seed(img2, function (torrent) {
t.equal(torrent.infoHash, 'fd5c8c050571e1f8c369541ed5560f7696931e3f')
})
client.seed(img3, function (torrent) {
t.equal(torrent.infoHash,'c36facf1ca9d3071a81bc8f85f77d3fa3b684048')
})
})
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.