Issue-686 - rfs.mkdtemp.spec.js (#717)
* Replaced 'var' with 'const' where applicable * Issue-686 - replacing 'var' with 'const', added 'use strict' fs.mkdtemp.spec.js * Issue-686 - replacing 'var' with 'const', updated 'use strict' fs.mkdtemp.spec.js
This commit is contained in:
parent
9d4b264479
commit
3c51bbb24f
|
@ -1,17 +1,19 @@
|
||||||
var util = require('../lib/test-utils.js');
|
'use strict';
|
||||||
var expect = require('chai').expect;
|
|
||||||
|
const util = require('../lib/test-utils.js');
|
||||||
|
const expect = require('chai').expect;
|
||||||
|
|
||||||
describe('fs.mkdtemp', function() {
|
describe('fs.mkdtemp', function() {
|
||||||
beforeEach(util.setup);
|
beforeEach(util.setup);
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
it('should be a function', function() {
|
it('should be a function', function() {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
expect(fs.mkdtemp).to.be.a('function');
|
expect(fs.mkdtemp).to.be.a('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should craete temp dir with specified prefix', function(done) {
|
it('should craete temp dir with specified prefix', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
fs.mkdtemp('/foo', function(error, path) {
|
fs.mkdtemp('/foo', function(error, path) {
|
||||||
expect(error).not.to.exist;
|
expect(error).not.to.exist;
|
||||||
expect(path).to.match(/foo-\w{6}/);
|
expect(path).to.match(/foo-\w{6}/);
|
||||||
|
@ -20,7 +22,7 @@ describe('fs.mkdtemp', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should craete temp dir inside existing directory', function(done) {
|
it('should craete temp dir inside existing directory', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
fs.mkdir('/myDir', (error) => {
|
fs.mkdir('/myDir', (error) => {
|
||||||
expect(error).not.to.exist;
|
expect(error).not.to.exist;
|
||||||
fs.mkdtemp('/myDir/foo', function(error, path) {
|
fs.mkdtemp('/myDir/foo', function(error, path) {
|
||||||
|
@ -32,7 +34,7 @@ describe('fs.mkdtemp', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not create temp dir without prefix', function(done) {
|
it('should not create temp dir without prefix', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
fs.mkdtemp('', function(error, path) {
|
fs.mkdtemp('', function(error, path) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
expect(path).not.to.exist;
|
expect(path).not.to.exist;
|
||||||
|
@ -41,7 +43,7 @@ describe('fs.mkdtemp', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not create temp dir inside non existing dir', function(done) {
|
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) {
|
fs.mkdtemp('/doesNotExists/foo', function(error, path) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
expect(error.code).to.be.equal('ENOENT');
|
expect(error.code).to.be.equal('ENOENT');
|
||||||
|
@ -49,4 +51,4 @@ describe('fs.mkdtemp', function() {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue