mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
Tests should be explicit regarding whether a promise is expected to settle, and the test should fail when the behavior does not meet expectations. PR-URL: https://github.com/nodejs/node/pull/60976 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
21 lines
484 B
JavaScript
21 lines
484 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
const { promises: fs } = require('fs');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const fn = fixtures.path('empty.txt');
|
|
|
|
fs.readFile(fn)
|
|
.then(assert.ok)
|
|
.then(common.mustCall());
|
|
|
|
fs.readFile(fn, 'utf8')
|
|
.then(assert.strictEqual.bind(this, ''))
|
|
.then(common.mustCall());
|
|
|
|
fs.readFile(fn, { encoding: 'utf8' })
|
|
.then(assert.strictEqual.bind(this, ''))
|
|
.then(common.mustCall());
|