summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-options-immutable.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-06-28 21:22:35 -0700
committerRich Trott <rtrott@gmail.com>2017-07-01 22:36:27 -0700
commitf05653dc45a68ff56e3a86375c1d952046b9ba3c (patch)
treee237fa0c26cfbfbaff60fb7a4e124857ecb37b69 /test/parallel/test-fs-options-immutable.js
parent48660fbb9d161f91ca63d02f5fda34a97c53e1c2 (diff)
downloadandroid-node-v8-f05653dc45a68ff56e3a86375c1d952046b9ba3c.tar.gz
android-node-v8-f05653dc45a68ff56e3a86375c1d952046b9ba3c.tar.bz2
android-node-v8-f05653dc45a68ff56e3a86375c1d952046b9ba3c.zip
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 PR-URL: https://github.com/nodejs/node/pull/13977 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'test/parallel/test-fs-options-immutable.js')
-rw-r--r--test/parallel/test-fs-options-immutable.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/parallel/test-fs-options-immutable.js b/test/parallel/test-fs-options-immutable.js
index 8993aebe0c..9d88cf0fa4 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));
- });
+ }));
});
}