Skip to content

Commit 5cd8cb6

Browse files
committed
add an unit test with the stream API
1 parent 33c1786 commit 5cd8cb6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const fs = require('fs');
5+
6+
fs.promises.open(__filename).then(common.mustCall((fd) => {
7+
const rs = new fs.ReadStream(null, {
8+
fd: fd,
9+
manualStart: false
10+
});
11+
setTimeout(() => assert(rs.bytesRead > 0), common.platformTimeout(10));
12+
}));
13+
14+
fs.promises.open(__filename).then(common.mustCall((fd) => {
15+
const rs = new fs.ReadStream(null, {
16+
fd: fd,
17+
manualStart: true
18+
});
19+
setTimeout(() => assert(rs.bytesRead === 0), common.platformTimeout(10));
20+
}));

0 commit comments

Comments
 (0)