mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +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>
31 lines
564 B
JavaScript
31 lines
564 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const {
|
|
rmdir,
|
|
rmdirSync,
|
|
promises: { rmdir: rmdirPromise }
|
|
} = require('fs');
|
|
|
|
assert.throws(() => {
|
|
rmdir('nonexistent', {
|
|
recursive: true,
|
|
}, common.mustNotCall());
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_VALUE',
|
|
});
|
|
|
|
assert.throws(() => {
|
|
rmdirSync('nonexistent', {
|
|
recursive: true,
|
|
});
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_VALUE',
|
|
});
|
|
|
|
assert.rejects(
|
|
rmdirPromise('nonexistent', { recursive: true }),
|
|
{ code: 'ERR_INVALID_ARG_VALUE' },
|
|
).then(common.mustCall());
|