-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: give names to promisified methods
Affected functions: `fs.exists`, `readline.Interface.prototype.question` PR-URL: #43218 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
- Loading branch information
1 parent
116abba
commit b659bab
Showing
3 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import '../common/index.mjs'; | ||
import assert from 'node:assert'; | ||
import { promisify } from 'node:util'; | ||
|
||
// Test that customly promisified methods in [util.promisify.custom] | ||
// have appropriate names | ||
|
||
import fs from 'node:fs'; | ||
import readline from 'node:readline'; | ||
import stream from 'node:stream'; | ||
import timers from 'node:timers'; | ||
|
||
|
||
assert.strictEqual( | ||
promisify(fs.exists).name, | ||
'exists' | ||
); | ||
|
||
assert.strictEqual( | ||
promisify(readline.Interface.prototype.question).name, | ||
'question', | ||
); | ||
|
||
assert.strictEqual( | ||
promisify(stream.finished).name, | ||
'finished' | ||
); | ||
assert.strictEqual( | ||
promisify(stream.pipeline).name, | ||
'pipeline' | ||
); | ||
|
||
assert.strictEqual( | ||
promisify(timers.setImmediate).name, | ||
'setImmediate' | ||
); | ||
assert.strictEqual( | ||
promisify(timers.setTimeout).name, | ||
'setTimeout' | ||
); |