0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-fs-fsync.js
Rob Adelmann 34991be450 test: refactor test-fs-fsync
- replace var with const.
- remove successes var.
- use assert.ifError() for handling all errors.
- wrap all callbacks with common.mustCall().

PR-URL: https://github.com/nodejs/node/pull/10176
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-12-13 15:59:35 -05:00

24 lines
501 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
const file = path.join(common.fixturesDir, 'a.js');
fs.open(file, 'a', 0o777, common.mustCall(function(err, fd) {
assert.ifError(err);
fs.fdatasyncSync(fd);
fs.fsyncSync(fd);
fs.fdatasync(fd, common.mustCall(function(err) {
assert.ifError(err);
fs.fsync(fd, common.mustCall(function(err) {
assert.ifError(err);
}));
}));
}));