Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaStoeva committed Jul 24, 2024
1 parent f1634c3 commit af54a06
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ describe('requests_utils', () => {
name: 'variable2',
value: 'test2',
},
{
id: '3',
name: 'variable3',
value: '{"match_all": {}}',
},
];

describe('replaces variables in the url', () => {
Expand Down Expand Up @@ -96,11 +101,20 @@ describe('requests_utils', () => {
const request = {
method: 'GET',
url: '${variable1}',
data: [JSON.stringify({ '${variable1}': '${variable2}' }, null, 2)],
data: [
JSON.stringify(
{ '${variable1}': '${variable2}', '${variable2}': '${variable3}' },
null,
2
),
],
};
it('works with several variables', () => {
const result = replaceRequestVariables(request, variables);
expect(result.data[0]).toBe(JSON.stringify({ test1: 'test2' }, null, 2));
expect(JSON.parse(result.data[0])).toMatchObject({
test1: 'test2',
test2: { match_all: {} },
});
});
});
});
Expand Down

0 comments on commit af54a06

Please sign in to comment.