🐛 Update: Added support for the 'find' command in settings.local.json. Enhanced logging for various modules, including initialization and performance metrics. Improved SQLite database optimization and ensured better tracking of user interactions and system processes. 📚
This commit is contained in:
28
network-visualization/node_modules/through/test/async.js
generated
vendored
Normal file
28
network-visualization/node_modules/through/test/async.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var from = require('from')
|
||||
var through = require('../')
|
||||
|
||||
var tape = require('tape')
|
||||
|
||||
tape('simple async example', function (t) {
|
||||
|
||||
var n = 0, expected = [1,2,3,4,5], actual = []
|
||||
from(expected)
|
||||
.pipe(through(function(data) {
|
||||
this.pause()
|
||||
n ++
|
||||
setTimeout(function(){
|
||||
console.log('pushing data', data)
|
||||
this.push(data)
|
||||
this.resume()
|
||||
}.bind(this), 300)
|
||||
})).pipe(through(function(data) {
|
||||
console.log('pushing data second time', data);
|
||||
this.push(data)
|
||||
})).on('data', function (d) {
|
||||
actual.push(d)
|
||||
}).on('end', function() {
|
||||
t.deepEqual(actual, expected)
|
||||
t.end()
|
||||
})
|
||||
|
||||
})
|
30
network-visualization/node_modules/through/test/auto-destroy.js
generated
vendored
Normal file
30
network-visualization/node_modules/through/test/auto-destroy.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var test = require('tape')
|
||||
var through = require('../')
|
||||
|
||||
// must emit end before close.
|
||||
|
||||
test('end before close', function (assert) {
|
||||
var ts = through()
|
||||
ts.autoDestroy = false
|
||||
var ended = false, closed = false
|
||||
|
||||
ts.on('end', function () {
|
||||
assert.ok(!closed)
|
||||
ended = true
|
||||
})
|
||||
ts.on('close', function () {
|
||||
assert.ok(ended)
|
||||
closed = true
|
||||
})
|
||||
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
ts.end()
|
||||
assert.ok(ended)
|
||||
assert.notOk(closed)
|
||||
ts.destroy()
|
||||
assert.ok(closed)
|
||||
assert.end()
|
||||
})
|
||||
|
71
network-visualization/node_modules/through/test/buffering.js
generated
vendored
Normal file
71
network-visualization/node_modules/through/test/buffering.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
var test = require('tape')
|
||||
var through = require('../')
|
||||
|
||||
// must emit end before close.
|
||||
|
||||
test('buffering', function(assert) {
|
||||
var ts = through(function (data) {
|
||||
this.queue(data)
|
||||
}, function () {
|
||||
this.queue(null)
|
||||
})
|
||||
|
||||
var ended = false, actual = []
|
||||
|
||||
ts.on('data', actual.push.bind(actual))
|
||||
ts.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
assert.deepEqual(actual, [1, 2, 3])
|
||||
ts.pause()
|
||||
ts.write(4)
|
||||
ts.write(5)
|
||||
ts.write(6)
|
||||
assert.deepEqual(actual, [1, 2, 3])
|
||||
ts.resume()
|
||||
assert.deepEqual(actual, [1, 2, 3, 4, 5, 6])
|
||||
ts.pause()
|
||||
ts.end()
|
||||
assert.ok(!ended)
|
||||
ts.resume()
|
||||
assert.ok(ended)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test('buffering has data in queue, when ends', function (assert) {
|
||||
|
||||
/*
|
||||
* If stream ends while paused with data in the queue,
|
||||
* stream should still emit end after all data is written
|
||||
* on resume.
|
||||
*/
|
||||
|
||||
var ts = through(function (data) {
|
||||
this.queue(data)
|
||||
}, function () {
|
||||
this.queue(null)
|
||||
})
|
||||
|
||||
var ended = false, actual = []
|
||||
|
||||
ts.on('data', actual.push.bind(actual))
|
||||
ts.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
ts.pause()
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
ts.end()
|
||||
assert.deepEqual(actual, [], 'no data written yet, still paused')
|
||||
assert.ok(!ended, 'end not emitted yet, still paused')
|
||||
ts.resume()
|
||||
assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered')
|
||||
assert.ok(ended, 'end should be emitted once all data was delivered')
|
||||
assert.end();
|
||||
})
|
45
network-visualization/node_modules/through/test/end.js
generated
vendored
Normal file
45
network-visualization/node_modules/through/test/end.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var test = require('tape')
|
||||
var through = require('../')
|
||||
|
||||
// must emit end before close.
|
||||
|
||||
test('end before close', function (assert) {
|
||||
var ts = through()
|
||||
var ended = false, closed = false
|
||||
|
||||
ts.on('end', function () {
|
||||
assert.ok(!closed)
|
||||
ended = true
|
||||
})
|
||||
ts.on('close', function () {
|
||||
assert.ok(ended)
|
||||
closed = true
|
||||
})
|
||||
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
ts.end()
|
||||
assert.ok(ended)
|
||||
assert.ok(closed)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test('end only once', function (t) {
|
||||
|
||||
var ts = through()
|
||||
var ended = false, closed = false
|
||||
|
||||
ts.on('end', function () {
|
||||
t.equal(ended, false)
|
||||
ended = true
|
||||
})
|
||||
|
||||
ts.queue(null)
|
||||
ts.queue(null)
|
||||
ts.queue(null)
|
||||
|
||||
ts.resume()
|
||||
|
||||
t.end()
|
||||
})
|
133
network-visualization/node_modules/through/test/index.js
generated
vendored
Normal file
133
network-visualization/node_modules/through/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
|
||||
var test = require('tape')
|
||||
var spec = require('stream-spec')
|
||||
var through = require('../')
|
||||
|
||||
/*
|
||||
I'm using these two functions, and not streams and pipe
|
||||
so there is less to break. if this test fails it must be
|
||||
the implementation of _through_
|
||||
*/
|
||||
|
||||
function write(array, stream) {
|
||||
array = array.slice()
|
||||
function next() {
|
||||
while(array.length)
|
||||
if(stream.write(array.shift()) === false)
|
||||
return stream.once('drain', next)
|
||||
|
||||
stream.end()
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
function read(stream, callback) {
|
||||
var actual = []
|
||||
stream.on('data', function (data) {
|
||||
actual.push(data)
|
||||
})
|
||||
stream.once('end', function () {
|
||||
callback(null, actual)
|
||||
})
|
||||
stream.once('error', function (err) {
|
||||
callback(err)
|
||||
})
|
||||
}
|
||||
|
||||
test('simple defaults', function(assert) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
var t = through()
|
||||
var s = spec(t).through().pausable()
|
||||
|
||||
read(t, function (err, actual) {
|
||||
assert.ifError(err)
|
||||
assert.deepEqual(actual, expected)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
t.on('close', s.validate)
|
||||
|
||||
write(expected, t)
|
||||
});
|
||||
|
||||
test('simple functions', function(assert) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
var t = through(function (data) {
|
||||
this.emit('data', data*2)
|
||||
})
|
||||
var s = spec(t).through().pausable()
|
||||
|
||||
|
||||
read(t, function (err, actual) {
|
||||
assert.ifError(err)
|
||||
assert.deepEqual(actual, expected.map(function (data) {
|
||||
return data*2
|
||||
}))
|
||||
assert.end()
|
||||
})
|
||||
|
||||
t.on('close', s.validate)
|
||||
|
||||
write(expected, t)
|
||||
})
|
||||
|
||||
test('pauses', function(assert) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l) //Math.random())
|
||||
|
||||
var t = through()
|
||||
|
||||
var s = spec(t)
|
||||
.through()
|
||||
.pausable()
|
||||
|
||||
t.on('data', function () {
|
||||
if(Math.random() > 0.1) return
|
||||
t.pause()
|
||||
process.nextTick(function () {
|
||||
t.resume()
|
||||
})
|
||||
})
|
||||
|
||||
read(t, function (err, actual) {
|
||||
assert.ifError(err)
|
||||
assert.deepEqual(actual, expected)
|
||||
})
|
||||
|
||||
t.on('close', function () {
|
||||
s.validate()
|
||||
assert.end()
|
||||
})
|
||||
|
||||
write(expected, t)
|
||||
})
|
||||
|
||||
test('does not soft-end on `undefined`', function(assert) {
|
||||
var stream = through()
|
||||
, count = 0
|
||||
|
||||
stream.on('data', function (data) {
|
||||
count++
|
||||
})
|
||||
|
||||
stream.write(undefined)
|
||||
stream.write(undefined)
|
||||
|
||||
assert.equal(count, 2)
|
||||
|
||||
assert.end()
|
||||
})
|
Reference in New Issue
Block a user