mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
test: replace .filter()[0] with .find()
PR-URL: https://github.com/nodejs/node/pull/58872 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
0b88e0927f
commit
f6a4305d16
|
|
@ -16,7 +16,7 @@ tmpdir.refresh();
|
|||
spawnSync(process.execPath, [ '--prof', '-p', '42' ], { cwd: tmpdir.path });
|
||||
|
||||
const files = fs.readdirSync(tmpdir.path);
|
||||
const logfile = files.filter((name) => /\.log$/.test(name))[0];
|
||||
const logfile = files.find((name) => /\.log$/.test(name));
|
||||
assert(logfile);
|
||||
|
||||
// Make sure that the --preprocess argument is passed through correctly,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const { once } = require('events');
|
|||
assert.strictEqual(fh.constructor.name, 'FileHandle');
|
||||
|
||||
const kTransfer = Object.getOwnPropertySymbols(Object.getPrototypeOf(fh))
|
||||
.filter((symbol) => symbol.description === 'messaging_transfer_symbol')[0];
|
||||
.find((symbol) => symbol.description === 'messaging_transfer_symbol');
|
||||
assert.strictEqual(typeof kTransfer, 'symbol');
|
||||
fh[kTransfer] = () => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
assert.strictEqual(fh.constructor.name, 'FileHandle');
|
||||
|
||||
const kTransfer = Object.getOwnPropertySymbols(Object.getPrototypeOf(fh))
|
||||
.filter((symbol) => symbol.description === 'messaging_transfer_symbol')[0];
|
||||
.find((symbol) => symbol.description === 'messaging_transfer_symbol');
|
||||
assert.strictEqual(typeof kTransfer, 'symbol');
|
||||
fh[kTransfer] = () => {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user