Skip to content

Commit

Permalink
Adapt tests to new behavior of FileSystem._runGlob which now throws f…
Browse files Browse the repository at this point in the history
…or GLOB errors

See SAP/ui5-fs#140
  • Loading branch information
RandomByte committed May 27, 2019
1 parent 7e40dfe commit 6fbdbf0
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions test/lib/server/middleware/serveIndex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const path = require("path");
const {test} = require("ava");
const resourceFactory = require("@ui5/fs").resourceFactory;

Expand All @@ -19,26 +18,20 @@ test.serial("Check if index for files is created", (t) => {
return writer.write(resource);
};

const filePath = path.join(process.cwd(), "./test/tmp/");
const reader = resourceFactory.createAdapter({fsBasePath: filePath, virBasePath: "/"});
const writer = resourceFactory.createAdapter({virBasePath: "/"});
const workspace = resourceFactory.createWorkspace({
reader: reader,
writer: writer
});
const readerWriter = resourceFactory.createAdapter({virBasePath: "/"});

return Promise.all([
writeResource(writer, "/myFile1.meh", 1024), // KB
writeResource(writer, "/myFile2.js", 1024 * 1024), // MB
writeResource(writer, "/myFile3.properties", 1024 * 1024 * 1024), // GB
writeResource(readerWriter, "/myFile1.meh", 1024), // KB
writeResource(readerWriter, "/myFile2.js", 1024 * 1024), // MB
writeResource(readerWriter, "/myFile3.properties", 1024 * 1024 * 1024), // GB
]).then(() => {
const middleware = serveIndexMiddleware({
resourceCollections: {
combo: workspace
combo: readerWriter
}
});

return new Promise((resolve) => {
return new Promise((resolve, reject) => {
const req = {
path: "/"
};
Expand All @@ -52,7 +45,8 @@ test.serial("Check if index for files is created", (t) => {
resolve();
},
};
const next = function() {
const next = function(err) {
reject(new Error(`Next callback called with error: ${err.message}`));
};
middleware(req, res, next);
});
Expand Down

0 comments on commit 6fbdbf0

Please sign in to comment.