summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-read-file-assert-encoding.js
diff options
context:
space:
mode:
authorVinícius do Carmo <vinicius.m.do.carmo@gmail.com>2017-01-23 14:39:40 -0300
committerGibson Fahnestock <gib@uk.ibm.com>2017-01-27 16:21:59 +0000
commitb19334e566650c381c4a49277b214f6ebcc55001 (patch)
treec3e72bdf157d761c686310fe25f1982d85e5ecdc /test/parallel/test-fs-read-file-assert-encoding.js
parentbee83e0bbc4f61c3bef3bb18043e3f39ea40a336 (diff)
downloadandroid-node-v8-b19334e566650c381c4a49277b214f6ebcc55001.tar.gz
android-node-v8-b19334e566650c381c4a49277b214f6ebcc55001.tar.bz2
android-node-v8-b19334e566650c381c4a49277b214f6ebcc55001.zip
test: expand test coverage of fs.js
* test reading a file passing a not valid enconding Refs: https://coverage.nodejs.org/coverage-067be658f966dafe/root/internal/fs.js.html PR-URL: https://github.com/nodejs/node/pull/10947 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-read-file-assert-encoding.js')
-rw-r--r--test/parallel/test-fs-read-file-assert-encoding.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-fs-read-file-assert-encoding.js b/test/parallel/test-fs-read-file-assert-encoding.js
new file mode 100644
index 0000000000..897bcd3bc9
--- /dev/null
+++ b/test/parallel/test-fs-read-file-assert-encoding.js
@@ -0,0 +1,13 @@
+'use strict';
+require('../common');
+
+const assert = require('assert');
+const fs = require('fs');
+
+const encoding = 'foo-8';
+const filename = 'bar.txt';
+
+assert.throws(
+ fs.readFile.bind(fs, filename, { encoding }, () => {}),
+ new RegExp(`Error: Unknown encoding: ${encoding}$`)
+);