mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00: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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user