Skip to content

Node.js based forum software built for the modern web

fix: subfolder handling in tests

Julian Lambbd97ccb4888
diff --git a/test/api.js b/test/api.js
index ed60f483c6..d444f0337f 100644
--- a/test/api.js
+++ b/test/api.js
@@ -179,6 +179,11 @@ describe('API', async () => {
if (!prefix && !dispatch.route.path.startsWith('/api/')) {
return null;
}
+
+ if (prefix === nconf.get('relative_path')) {
+ prefix = '';
+ }
+
return {
method: Object.keys(dispatch.route.methods)[0],
path: (prefix || '') + dispatch.route.path,
@@ -360,7 +365,8 @@ describe('API', async () => {
if (http302 && response.statusCode === 302) {
// Compare headers instead
const expectedHeaders = Object.keys(http302.headers).reduce((memo, name) => {
- memo[name] = http302.headers[name].schema.example;
+ const value = http302.headers[name].schema.example;
+ memo[name] = value.startsWith(nconf.get('relative_path')) ? value : nconf.get('relative_path') + value;
return memo;
}, {});