Skip to content

Commit

Permalink
test(lib): add additional case to cover already regrouped tree
Browse files Browse the repository at this point in the history
  • Loading branch information
narekhovhannisyan committed Dec 17, 2024
1 parent 90df77a commit 4f7a316
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/__tests__/if-run/lib/compute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,32 @@ describe('lib/compute: ', () => {
expect(response.children.mockChild.children).toEqual(expectedResponse);
});

it('skips regrouping on already regrouped data.', async () => {
const {compute} = require('../../../if-run/lib/compute');
const expectedResponse = {
'uk-west': {
inputs: [{region: 'uk-west', timestamp: 'mock-timestamp-1'}],
},
'uk-east': {
inputs: [
{region: 'uk-east', timestamp: 'mock-timestamp-2'},
{region: 'uk-east', timestamp: 'mock-timestamp-3'},
],
},
};
const tree = {
children: {
mockChild: {
pipeline: {regroup: ['region']},
children: expectedResponse,
},
},
};
const response = await compute(tree, paramsExecute);

expect(response.children.mockChild.children).toEqual(expectedResponse);
});

it('computes simple tree with regroup, grouping inputs and outputs.', async () => {
const {compute} = require('../../../if-run/lib/compute');
const tree = {
Expand Down

0 comments on commit 4f7a316

Please sign in to comment.