From bbd97ccb4888a678c4ff20222c2ba1cc157209dd Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 18 Dec 2020 12:28:32 -0500 Subject: [PATCH] fix: subfolder handling in tests --- test/api.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; }, {});