Skip to content

Commit

Permalink
Added the tests for the chunked packets
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed May 25, 2017
1 parent 53971da commit 06b9c56
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
8 changes: 6 additions & 2 deletions test/tests/writePhysicalFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ module.exports = (test, options, index) => test('write in a physical file', (isV
{
var files = {
'file1.txt': 'this is the content!',
'file2.txt': new Buffer([ 10, 12, 16, 100, 125, 200, 250 ])
'file2.txt': new Buffer([ 10, 12, 16, 100, 125, 200, 250 ]),
'testFile3.txt': new Buffer(100000)
}

for(let i = 0; i < files['testFile3.txt'].length; ++i)
files['testFile3.txt'].write('X', i, 1, 'utf-8');

isValid = isValid.multiple(Object.keys(files).length, server);
const _ = (e, cb) => {
if(e)
Expand All @@ -34,7 +38,7 @@ module.exports = (test, options, index) => test('write in a physical file', (isV
if(e)
isValid(false, e)
else
isValid(content.toString() === files[fileName].toString(), 'Received : ' + content.toString() + ' but expected : ' + files[fileName].toString());
isValid(content.toString() === files[fileName].toString(), 'Received : "' + content.toString().substring(0, 30) + (content.length > 30 ? '[... ' + content.length + ' more]' : '') + '" but expected : "' + files[fileName].toString().substring(0, 30) + (files[fileName].length > 30 ? '[... ' + files[fileName].length + ' more]' : '') + '"');
})
}))
}))
Expand Down
2 changes: 1 addition & 1 deletion test/tests/writePhysicalFile/file2.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

d}��
d}��
1 change: 1 addition & 0 deletions test/tests/writePhysicalFile/testFile3.txt

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions test/tests/writeVirtualFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ module.exports = (test, options, index) => test('write in a virtual file', (isVa
{
var files = {
'testFile1.txt': 'this is the content!',
'testFile2.txt': new Buffer([ 10, 12, 16, 100, 125, 200, 250 ])
'testFile2.txt': new Buffer([ 10, 12, 16, 100, 125, 200, 250 ]),
'testFile3.txt': new Buffer(100000)
}

for(let i = 0; i < files['testFile3.txt'].length; ++i)
files['testFile3.txt'].write('X', i, 1, 'utf-8');

isValid = isValid.multiple(Object.keys(files).length, server);
const _ = (e, cb) => {
if(e)
Expand All @@ -31,7 +35,7 @@ module.exports = (test, options, index) => test('write in a virtual file', (isVa
if(e)
isValid(false, e)
else
isValid(content.toString() === files[fileName].toString(), 'Received : ' + content.toString() + ' but expected : ' + files[fileName].toString());
isValid(content.toString() === files[fileName].toString(), 'Received : "' + content.toString().substring(0, 30) + (content.length > 30 ? '[... ' + content.length + ' more]' : '') + '" but expected : "' + files[fileName].toString().substring(0, 30) + (files[fileName].length > 30 ? '[... ' + files[fileName].length + ' more]' : '') + '"');
})
}))
}));
Expand Down

0 comments on commit 06b9c56

Please sign in to comment.