Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modify code style of the test
  • Loading branch information
陈刚 committed Jan 13, 2018
commit 609404fbdf1a3b99aafbdadf702faceac5f805ad
22 changes: 11 additions & 11 deletions test/sequential/test-stream2-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');

Expand Down Expand Up @@ -69,15 +69,15 @@ w.on('results', function(res) {

r.pipe(w);

const optionsEnd = 3;
const optionsEndExpectLength = optionsEnd + 1;
const rOfEnd = new FSReadable(file, {
end: optionsEnd,
});
const wOfEnd = new TestWriter();
{
// Verify that end works when start is not specified.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file here is named test-stream2-fs and it's in sequential. I think the test case added here belongs to test/parallel/test-fs-read-stream.js since it's more of a fs test, not a stream2 test. (Also I think this file can be moved to parallel? Although that should be done in another PR).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I just moved the new test case to test/parallel/test-fs-read-stream.js.

const end = 3;
const r = new FSReadable(file, { end });
const w = new TestWriter();

wOfEnd.on('results', function(res) {
assert.strictEqual(wOfEnd.length, optionsEndExpectLength);
});
w.on('results', common.mustCall((res) => {
assert.strictEqual(w.length, end + 1);
}));

rOfEnd.pipe(wOfEnd);
r.pipe(w);
}