Skip to content

Commit 5260eb9

Browse files
committed
[INTERNAL] Fix and enhance tests
Also remove mtime from resources. Unknown why that got added in the first place
1 parent 1ac2fcb commit 5260eb9

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

lib/adapters/AbstractAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class AbstractAdapter extends AbstractReaderWriter {
105105
continue;
106106
}
107107
} else if (globPart === minimatch.GLOBSTAR) {
108-
return i;
108+
return {idx: i};
109109
} else { // Regex
110110
if (!globPart.test(basePathPart)) {
111111
return null;

lib/adapters/FileSystem.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ class FileSystem extends AbstractAdapter {
118118
statInfo: { // TODO: make closer to fs stat info
119119
isDirectory: function() {
120120
return true;
121-
},
122-
mtime: new Date()
121+
}
123122
},
124123
path: virPath
125124
}));

lib/adapters/Memory.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ class Memory extends AbstractAdapter {
3838
statInfo: { // TODO: make closer to fs stat info
3939
isDirectory: function() {
4040
return true;
41-
},
42-
mtime: new Date()
41+
}
4342
},
4443
path: this._virBasePath.slice(0, -1)
4544
})

test/lib/resources.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ test("Virtual RL: GLOB resources from application.a w/o virtual base path prefix
9696

9797
test("Virtual RL: GLOB virtual directory w/o virtual base path prefix", (t) => {
9898
// TODO: Add similar test (globbing on empty directory) for FS RL
99-
// TODO: Also add tests for nodir: true option
10099
let readerWriter = ui5Fs.resourceFactory.createAdapter({
101100
virBasePath: "/app/"
102101
});
@@ -110,9 +109,7 @@ test("Virtual RL: GLOB virtual directory w/o virtual base path prefix", (t) => {
110109
);
111110
});
112111

113-
test.only("Virtual RL: GLOB virtual directory w/ virtual base path prefix", (t) => {
114-
// TODO: Add similar test (globbing on empty directory) for FS RL
115-
// TODO: Also add tests for nodir: true option
112+
test("Virtual RL: GLOB virtual directory w/ virtual base path prefix", (t) => {
116113
let readerWriter = ui5Fs.resourceFactory.createAdapter({
117114
virBasePath: "/app/one/two/"
118115
});
@@ -125,3 +122,31 @@ test.only("Virtual RL: GLOB virtual directory w/ virtual base path prefix", (t)
125122
})
126123
);
127124
});
125+
126+
test("Virtual RL: GLOB virtual directory w/o virtual base path prefix", (t) => {
127+
let readerWriter = ui5Fs.resourceFactory.createAdapter({
128+
virBasePath: "/app/"
129+
});
130+
131+
// Get resource from one readerWriter
132+
return t.notThrows(
133+
readerWriter.byGlob("/*", {nodir: true})
134+
.then((resources) => {
135+
t.deepEqual(resources.length, 0, "Found exactly one resource");
136+
})
137+
);
138+
});
139+
140+
test("Virtual RL: GLOB virtual directory w/ virtual base path prefix", (t) => {
141+
let readerWriter = ui5Fs.resourceFactory.createAdapter({
142+
virBasePath: "/app/one/two/"
143+
});
144+
145+
// Get resource from one readerWriter
146+
return t.notThrows(
147+
readerWriter.byGlob("/*", {nodir: true})
148+
.then((resources) => {
149+
t.deepEqual(resources.length, 0, "Found exactly one resource");
150+
})
151+
);
152+
});

0 commit comments

Comments
 (0)