Tizen 2.0 Release
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / testswarm / node_modules / request / node_modules / form-data / node_modules / combined-stream / test / integration / test-max-data-size.js
1 var common = require('../common');
2 var assert = common.assert;
3 var CombinedStream = common.CombinedStream;
4 var fs = require('fs');
5
6 var FILE1 = common.dir.fixture + '/file1.txt';
7 var FILE2 = common.dir.fixture + '/file2.txt';
8 var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
9
10 (function testDelayedStreams() {
11   var combinedStream = CombinedStream.create({pauseStreams: false, maxDataSize: 20736});
12   combinedStream.append(fs.createReadStream(FILE1));
13   combinedStream.append(fs.createReadStream(FILE2));
14
15   var gotErr = null;
16   combinedStream.on('error', function(err) {
17     gotErr = err;
18   });
19
20   process.on('exit', function() {
21     assert.ok(gotErr);
22     assert.ok(gotErr.message.match(/bytes/));
23   });
24 })();