mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-13 10:11:15 +01:00
22 lines
824 B
JavaScript
22 lines
824 B
JavaScript
|
const { describe, it, expect } = require('@jest/globals');
|
||
|
|
||
|
const prepareRequest = require('../../src/ipc/network/prepare-request');
|
||
|
|
||
|
describe('prepare-request: prepareRequest', () => {
|
||
|
describe('Decomments request body', () => {
|
||
|
it('If request body is valid JSON', async () => {
|
||
|
const body = { mode: 'json', json: '{\n"test": "{{someVar}}" // comment\n}' };
|
||
|
const expected = { test: '{{someVar}}' };
|
||
|
const result = prepareRequest({ body });
|
||
|
expect(result.data).toEqual(expected);
|
||
|
});
|
||
|
|
||
|
it('If request body is not valid JSON', async () => {
|
||
|
const body = { mode: 'json', json: '{\n"test": {{someVar}} // comment\n}' };
|
||
|
const expected = '{\n"test": {{someVar}} \n}';
|
||
|
const result = prepareRequest({ body });
|
||
|
expect(result.data).toEqual(expected);
|
||
|
});
|
||
|
});
|
||
|
});
|