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

Add a test for writeFile when filename is undefine ? #456

Closed
DinahLin opened this issue Sep 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@DinahLin
Copy link
Contributor

commented Sep 23, 2018

If it is the success, the filename is undefined, when we write a file from original to a destination.
I would like to work on the test method to check.
var util = require('../lib/test-utils.js');
var expect = require('chai').expect;

describe('fs.readdir on non-dir paths, issue 267', function() {
beforeEach(util.setup);
afterEach(util.cleanup);

it('should fail with ENOTDIR when called on filepath', function(done) {
var fs = util.fs();

fs.writeFile('/myfile.txt', 'data', function(err) {
  if(err) throw err;

  fs.readdir('/myfile.txt', function(err, contents) {
    expect(err).to.exist;
    expect(err.code).to.equal('ENOTDIR');
    expect(contents).not.to.exist;
    done();
  });
});

});
});

@humphd

This comment has been minimized.

Copy link
Contributor

commented Sep 23, 2018

Great, go for it @DinahLin

@humphd humphd closed this in 4a5d8c1 Dec 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.