Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-686 - rfs.mkdtemp.spec.js #717

Merged
merged 3 commits into from Feb 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions tests/spec/fs.mkdtemp.spec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
var util = require('../lib/test-utils.js');
var expect = require('chai').expect;
'use strict';

const util = require('../lib/test-utils.js');
const expect = require('chai').expect;

describe('fs.mkdtemp', function() {
beforeEach(util.setup);
afterEach(util.cleanup);

it('should be a function', function() {
var fs = util.fs();
const fs = util.fs();
expect(fs.mkdtemp).to.be.a('function');
});

it('should craete temp dir with specified prefix', function(done) {
var fs = util.fs();
const fs = util.fs();
fs.mkdtemp('/foo', function(error, path) {
expect(error).not.to.exist;
expect(path).to.match(/foo-\w{6}/);
Expand All @@ -20,7 +22,7 @@ describe('fs.mkdtemp', function() {
});

it('should craete temp dir inside existing directory', function(done) {
var fs = util.fs();
const fs = util.fs();
fs.mkdir('/myDir', (error) => {
expect(error).not.to.exist;
fs.mkdtemp('/myDir/foo', function(error, path) {
Expand All @@ -32,7 +34,7 @@ describe('fs.mkdtemp', function() {
});

it('should not create temp dir without prefix', function(done) {
var fs = util.fs();
const fs = util.fs();
fs.mkdtemp('', function(error, path) {
expect(error).to.exist;
expect(path).not.to.exist;
Expand All @@ -41,12 +43,12 @@ describe('fs.mkdtemp', function() {
});

it('should not create temp dir inside non existing dir', function(done) {
var fs = util.fs();
const fs = util.fs();
fs.mkdtemp('/doesNotExists/foo', function(error, path) {
expect(error).to.exist;
expect(error.code).to.be.equal('ENOENT');
expect(path).to.exist;
done();
});
});
});
});