From 1021aeb42bbd6a3dbb214d33917e2e98df4d7368 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 28 Jun 2017 21:22:35 -0700 Subject: [PATCH] test: refactor test-fs-options-immutable * Reorder require() statements per test-writing guide * Use common.mustNotCall() to check that callback is not invoked * Use common.mustCall() to check that callback is invoked --- test/parallel/test-fs-options-immutable.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-fs-options-immutable.js b/test/parallel/test-fs-options-immutable.js index 8993aebe0c73dc..9d88cf0fa42697 100644 --- a/test/parallel/test-fs-options-immutable.js +++ b/test/parallel/test-fs-options-immutable.js @@ -1,4 +1,5 @@ 'use strict'; +const common = require('../common'); /* * These tests make sure that the `options` object passed to these functions are @@ -7,10 +8,10 @@ * Refer: https://github.com/nodejs/node/issues/7655 */ -const common = require('../common'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); +const path = require('path'); + const errHandler = (e) => assert.ifError(e); const options = Object.freeze({}); common.refreshTmpDir(); @@ -61,13 +62,15 @@ if (common.canCreateSymLink()) { { let watch; assert.doesNotThrow(() => { - watch = fs.watch(__filename, options, common.noop); + watch = fs.watch(__filename, options, common.mustNotCall()); }); watch.close(); } { - assert.doesNotThrow(() => fs.watchFile(__filename, options, common.noop)); + assert.doesNotThrow( + () => fs.watchFile(__filename, options, common.mustNotCall()) + ); fs.unwatchFile(__filename); } @@ -89,8 +92,8 @@ if (common.canCreateSymLink()) { { const fileName = path.resolve(common.tmpDir, 'streams'); assert.doesNotThrow(() => { - fs.WriteStream(fileName, options).once('open', () => { + fs.WriteStream(fileName, options).once('open', common.mustCall(() => { assert.doesNotThrow(() => fs.ReadStream(fileName, options)); - }); + })); }); }