Skip to content

Commit

Permalink
test: fix fsPromises.truncate test to avoid error
Browse files Browse the repository at this point in the history
  • Loading branch information
Masashi Hirano committed May 25, 2018
1 parent ed6f0fd commit a35a91c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test/parallel/test-fs-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const {
mkdir,
mkdtemp,
open,
read,
readFile,
readdir,
readlink,
Expand All @@ -26,7 +25,6 @@ const {
stat,
symlink,
truncate,
write,
unlink,
utimes
} = fsPromises;
Expand Down Expand Up @@ -102,6 +100,8 @@ function verifyStatObject(stat) {
const ret2 = await handle.read(Buffer.alloc(buf2Len), 0, buf2Len, 0);
assert.strictEqual(ret2.bytesRead, buf2Len);
assert.deepStrictEqual(ret2.buffer, buf2);
await truncate(dest, 5);
assert.deepStrictEqual((await readFile(dest)).toString(), 'hello');

await chmod(dest, 0o666);
await handle.chmod(0o666);
Expand All @@ -125,9 +125,6 @@ function verifyStatObject(stat) {

await handle.close();

await truncate(dest, 5);
assert.deepStrictEqual((await readFile(dest)).toString(), 'hello');

const newPath = path.resolve(tmpDir, 'baz2.js');
await rename(dest, newPath);
stats = await stat(newPath);
Expand Down

0 comments on commit a35a91c

Please sign in to comment.