Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / stream-counter / test / test.js
1 var ByteCounter = require('../');
2 var fs = require('fs');
3 var path = require('path');
4 var assert = require('assert');
5
6 var counter = new ByteCounter();
7 var remainingTests = 2;
8 counter.once('progress', function() {
9   assert.strictEqual(counter.bytes, 5);
10   remainingTests -= 1;
11 });
12 var is = fs.createReadStream(path.join(__dirname, 'test.txt'));
13 is.pipe(counter);
14 is.on('end', function() {
15   remainingTests -= 1;
16   assert.strictEqual(counter.bytes, 5);
17 });
18 process.on('exit', function() {
19   assert.strictEqual(remainingTests, 0);
20 });