mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: subfolder handling in tests
This commit is contained in:
		| @@ -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; | ||||
| 						}, {}); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user