mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 14:08:38 +00:00
fix: add missing URL helper translations for Bruno to Postman export (#7026)
* fix: add missing URL helper translations for Bruno to Postman export * fix : comment
This commit is contained in:
@@ -178,4 +178,29 @@ console.log("Headers:", JSON.stringify(pm.request.headers));
|
||||
const translatedCode = translateBruToPostman(code);
|
||||
expect(translatedCode).toBe('const body = {id: 1}; pm.request.body.update({\n mode: "raw",\n raw: JSON.stringify(body)\n});');
|
||||
});
|
||||
|
||||
// URL helper methods tests
|
||||
it('should translate req.getHost() to pm.request.url.getHost()', () => {
|
||||
const code = 'const host = req.getHost();';
|
||||
const translatedCode = translateBruToPostman(code);
|
||||
expect(translatedCode).toBe('const host = pm.request.url.getHost();');
|
||||
});
|
||||
|
||||
it('should translate req.getPath() to pm.request.url.getPath()', () => {
|
||||
const code = 'const path = req.getPath();';
|
||||
const translatedCode = translateBruToPostman(code);
|
||||
expect(translatedCode).toBe('const path = pm.request.url.getPath();');
|
||||
});
|
||||
|
||||
it('should translate req.getQueryString() to pm.request.url.getQueryString()', () => {
|
||||
const code = 'const queryString = req.getQueryString();';
|
||||
const translatedCode = translateBruToPostman(code);
|
||||
expect(translatedCode).toBe('const queryString = pm.request.url.getQueryString();');
|
||||
});
|
||||
|
||||
it('should translate req.getPathParams() to pm.request.url.variables (function to property)', () => {
|
||||
const code = 'const pathParams = req.getPathParams();';
|
||||
const translatedCode = translateBruToPostman(code);
|
||||
expect(translatedCode).toBe('const pathParams = pm.request.url.variables;');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user