filer/tests/bugs/issue105.js

37 lines
1004 B
JavaScript
Raw Normal View History

2014-05-23 20:53:50 +00:00
var Filer = require('../..');
var util = require('../lib/test-utils.js');
var expect = require('chai').expect;
2014-05-23 20:53:50 +00:00
describe('trailing slashes in path names, issue 105', function() {
beforeEach(util.setup);
afterEach(util.cleanup);
2014-05-23 20:53:50 +00:00
it('should deal with trailing slashes properly, path == path/', function(done) {
var fs = util.fs();
2014-05-23 20:53:50 +00:00
fs.mkdir('/tmp', function(err) {
if(err) throw err;
fs.mkdir('/tmp/foo', function(err) {
if(err) throw err;
2014-05-23 20:53:50 +00:00
// Without trailing slash
fs.readdir('/tmp', function(err, result1) {
if(err) throw err;
2014-05-23 20:53:50 +00:00
expect(result1).to.exist;
expect(result1.length).to.equal(1);
2014-05-23 20:53:50 +00:00
// With trailing slash
fs.readdir('/tmp/', function(err, result2) {
if(err) throw err;
2014-05-23 20:53:50 +00:00
expect(result2).to.exist;
expect(result2[0]).to.equal('foo');
expect(result1).to.deep.equal(result2);
done();
});
});
});
});
});
});