diff --git a/lib/adapters/AbstractAdapter.js b/lib/adapters/AbstractAdapter.js index 80bc10da..db08473b 100644 --- a/lib/adapters/AbstractAdapter.js +++ b/lib/adapters/AbstractAdapter.js @@ -110,7 +110,7 @@ class AbstractAdapter extends AbstractReaderWriter { continue; } } else if (globPart === minimatch.GLOBSTAR) { - return i; + return {idx: i}; } else { // Regex if (!globPart.test(basePathPart)) { return null; diff --git a/lib/adapters/FileSystem.js b/lib/adapters/FileSystem.js index 04f46e34..3f60dd43 100644 --- a/lib/adapters/FileSystem.js +++ b/lib/adapters/FileSystem.js @@ -120,8 +120,7 @@ class FileSystem extends AbstractAdapter { statInfo: { // TODO: make closer to fs stat info isDirectory: function() { return true; - }, - mtime: new Date() + } }, path: virPath })); diff --git a/lib/adapters/Memory.js b/lib/adapters/Memory.js index 84128bf8..1e37280f 100644 --- a/lib/adapters/Memory.js +++ b/lib/adapters/Memory.js @@ -42,8 +42,7 @@ class Memory extends AbstractAdapter { statInfo: { // TODO: make closer to fs stat info isDirectory: function() { return true; - }, - mtime: new Date() + } }, path: this._virBasePath.slice(0, -1) }) diff --git a/test/lib/resources.js b/test/lib/resources.js index 48ca8011..8e48d0d8 100644 --- a/test/lib/resources.js +++ b/test/lib/resources.js @@ -224,7 +224,6 @@ test("Virtual RL: GLOB resources from application.a w/o virtual base path prefix test("Virtual RL: GLOB virtual directory w/o virtual base path prefix", (t) => { // TODO: Add similar test (globbing on empty directory) for FS RL - // TODO: Also add tests for nodir: true option const readerWriter = ui5Fs.resourceFactory.createAdapter({ virBasePath: "/app/" }); @@ -240,7 +239,6 @@ test("Virtual RL: GLOB virtual directory w/o virtual base path prefix", (t) => { test("Virtual RL: GLOB virtual directory w/ virtual base path prefix", (t) => { // TODO: Add similar test (globbing on empty directory) for FS RL - // TODO: Also add tests for nodir: true option const readerWriter = ui5Fs.resourceFactory.createAdapter({ virBasePath: "/app/one/two/" }); @@ -254,6 +252,34 @@ test("Virtual RL: GLOB virtual directory w/ virtual base path prefix", (t) => { ); }); +test("Virtual RL: GLOB virtual directory w/o virtual base path prefix and nodir: true", (t) => { + const readerWriter = ui5Fs.resourceFactory.createAdapter({ + virBasePath: "/app/" + }); + + // Get resource from one readerWriter + return t.notThrows( + readerWriter.byGlob("/*", {nodir: true}) + .then((resources) => { + t.deepEqual(resources.length, 0, "Found exactly one resource"); + }) + ); +}); + +test("Virtual RL: GLOB virtual directory w/ virtual base path prefix and nodir: true", (t) => { + const readerWriter = ui5Fs.resourceFactory.createAdapter({ + virBasePath: "/app/one/two/" + }); + + // Get resource from one readerWriter + return t.notThrows( + readerWriter.byGlob("/*", {nodir: true}) + .then((resources) => { + t.deepEqual(resources.length, 0, "Found exactly one resource"); + }) + ); +}); + test("createCollectionsForTree", (t) => { // Creates resource reader collections for a given tree const resourceReaders = ui5Fs.resourceFactory.createCollectionsForTree(applicationBTree);