summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-truncate.js
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2020-09-06 22:27:07 +0200
committerAntoine du Hamel <duhamelantoine1995@gmail.com>2020-10-17 00:48:26 +0200
commit30fb4a015db2226aabaed457ec8930c9f9b8fd78 (patch)
treeaade0fc22dbcb9df6e1c22d5269e312716be7d22 /test/parallel/test-fs-truncate.js
parenteeb6b473fd9f8399583fafe1807781dd1e760c5e (diff)
downloadnode-new-30fb4a015db2226aabaed457ec8930c9f9b8fd78.tar.gz
test: add common.mustSucceed
PR-URL: https://github.com/nodejs/node/pull/35086 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-truncate.js')
-rw-r--r--test/parallel/test-fs-truncate.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/test/parallel/test-fs-truncate.js b/test/parallel/test-fs-truncate.js
index c41f31376f..418d56c047 100644
--- a/test/parallel/test-fs-truncate.js
+++ b/test/parallel/test-fs-truncate.js
@@ -71,9 +71,8 @@ fs.truncateSync(fd);
fs.closeSync(fd);
// Async tests
-testTruncate(common.mustCall(function(er) {
- assert.ifError(er);
- testFtruncate(common.mustCall(assert.ifError));
+testTruncate(common.mustSucceed(() => {
+ testFtruncate(common.mustSucceed());
}));
function testTruncate(cb) {
@@ -155,8 +154,7 @@ function testFtruncate(cb) {
{
const file3 = path.resolve(tmp, 'truncate-file-3.txt');
fs.writeFileSync(file3, 'Hi');
- fs.truncate(file3, 4, common.mustCall(function(err) {
- assert.ifError(err);
+ fs.truncate(file3, 4, common.mustSucceed(() => {
assert(fs.readFileSync(file3).equals(Buffer.from('Hi\u0000\u0000')));
}));
}
@@ -166,8 +164,7 @@ function testFtruncate(cb) {
fs.writeFileSync(file4, 'Hi');
const fd = fs.openSync(file4, 'r+');
process.on('beforeExit', () => fs.closeSync(fd));
- fs.ftruncate(fd, 4, common.mustCall(function(err) {
- assert.ifError(err);
+ fs.ftruncate(fd, 4, common.mustSucceed(() => {
assert(fs.readFileSync(file4).equals(Buffer.from('Hi\u0000\u0000')));
}));
}
@@ -221,8 +218,7 @@ function testFtruncate(cb) {
);
});
- fs.ftruncate(fd, undefined, common.mustCall(function(err) {
- assert.ifError(err);
+ fs.ftruncate(fd, undefined, common.mustSucceed(() => {
assert(fs.readFileSync(file5).equals(Buffer.from('')));
}));
}
@@ -232,8 +228,7 @@ function testFtruncate(cb) {
fs.writeFileSync(file6, 'Hi');
const fd = fs.openSync(file6, 'r+');
process.on('beforeExit', () => fs.closeSync(fd));
- fs.ftruncate(fd, -1, common.mustCall(function(err) {
- assert.ifError(err);
+ fs.ftruncate(fd, -1, common.mustSucceed(() => {
assert(fs.readFileSync(file6).equals(Buffer.from('')));
}));
}
@@ -241,8 +236,7 @@ function testFtruncate(cb) {
{
const file7 = path.resolve(tmp, 'truncate-file-7.txt');
fs.writeFileSync(file7, 'Hi');
- fs.truncate(file7, undefined, common.mustCall(function(err) {
- assert.ifError(err);
+ fs.truncate(file7, undefined, common.mustSucceed(() => {
assert(fs.readFileSync(file7).equals(Buffer.from('')));
}));
}