From 7e09a4dfe1af71a06465da98b889744f3eed5df1 Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Thu, 6 Feb 2014 22:38:39 -0500 Subject: [PATCH] Failing test for issue 105 --- tests/spec/regression/issue105.js | 55 +++++++++++++++++++++++++++++++ tests/test-manifest.js | 5 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/spec/regression/issue105.js diff --git a/tests/spec/regression/issue105.js b/tests/spec/regression/issue105.js new file mode 100644 index 0000000..4c09cd8 --- /dev/null +++ b/tests/spec/regression/issue105.js @@ -0,0 +1,55 @@ +define(["Filer"], function(Filer) { + + describe('trailing slashes in path names, issue 105', function() { + beforeEach(function() { + this.db_name = mk_db_name(); + this.fs = new Filer.FileSystem({ + name: this.db_name, + flags: 'FORMAT' + }); + }); + + afterEach(function() { + indexedDB.deleteDatabase(this.db_name); + delete this.fs; + }); + + it('should deal with trailing slashes properly, path == path/', function() { + var complete = false; + var _result1, _result2; + var fs = this.fs; + + fs.mkdir('/tmp', function(err) { + if(err) throw err; + + fs.mkdir('/tmp/foo', function(err) { + if(err) throw err; + + // Without trailing slash + fs.readdir('/tmp', function(err, result1) { + if(err) throw err; + _result1 = result1; + + // With trailing slash + fs.readdir('/tmp/', function(err, result2) { + if(err) throw err; + _result2 = result2; + + complete = true; + }); + }); + }); + }); + + waitsFor(function() { + return complete; + }, 'test to complete', DEFAULT_TIMEOUT); + + runs(function() { + expect(_result1.length).toEqual(1); + expect(_result2[0]).toEqual('tmp'); + expect(_result1).toEqual(_result2); + }); + }); + }); +}); diff --git a/tests/test-manifest.js b/tests/test-manifest.js index 43a549b..10f325d 100644 --- a/tests/test-manifest.js +++ b/tests/test-manifest.js @@ -44,6 +44,9 @@ define([ // Ported node.js tests (filenames match names in https://github.com/joyent/node/tree/master/test) "spec/node-js/simple/test-fs-mkdir", - "spec/node-js/simple/test-fs-null-bytes" + "spec/node-js/simple/test-fs-null-bytes", + + // Regressions, Bugs + "spec/regression/issue105" ]);