Skip to content

Commit d88c028

Browse files
committed
test: add test for customly promisified method names
1 parent 2aca975 commit d88c028

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import '../common/index.mjs';
2+
import assert from 'node:assert';
3+
import { promisify } from 'node:util';
4+
5+
// Test that customly promisified methods in [util.promisify.custom]
6+
// have appropriate names
7+
8+
import fs from 'node:fs';
9+
import readline from 'node:readline';
10+
import stream from 'node:stream';
11+
import timers from 'node:timers';
12+
13+
14+
assert.strictEqual(
15+
promisify(fs.exists).name,
16+
'exists'
17+
);
18+
19+
assert.strictEqual(
20+
promisify(readline.Interface.prototype.question).name,
21+
'question',
22+
);
23+
24+
assert.strictEqual(
25+
promisify(stream.finished).name,
26+
'finished'
27+
);
28+
assert.strictEqual(
29+
promisify(stream.pipeline).name,
30+
'pipeline'
31+
);
32+
33+
assert.strictEqual(
34+
promisify(timers.setImmediate).name,
35+
'setImmediate'
36+
);
37+
assert.strictEqual(
38+
promisify(timers.setTimeout).name,
39+
'setTimeout'
40+
);

0 commit comments

Comments
 (0)