-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: refactor mkdtemp test and added async
This test refactored the original test for mkdtempSync prefix validation and added the test also for the async function mkdtemp.
- Loading branch information
1 parent
4a5a944
commit daa39cd
Showing
2 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
|
||
const expectedError = /^TypeError: filename prefix is required$/; | ||
const prefixValues = [undefined, null, 0, true, false, 1, '']; | ||
|
||
function fail(value) { | ||
assert.throws( | ||
() => fs.mkdtempSync(value, {}), | ||
expectedError | ||
); | ||
} | ||
|
||
function failAsync(value) { | ||
assert.throws( | ||
() => fs.mkdtemp(value, common.mustNotCall()), expectedError | ||
); | ||
} | ||
|
||
prefixValues.forEach((prefixValue) => { | ||
fail(prefixValue); | ||
failAsync(prefixValue); | ||
}); |
This file was deleted.
Oops, something went wrong.