Skip to content

Commit

Permalink
test(builtins): add cases to cover interpolation input 0 and off
Browse files Browse the repository at this point in the history
  • Loading branch information
narekhovhannisyan committed Oct 15, 2024
1 parent a379f15 commit 702b961
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/__tests__/if-run/builtins/interpolation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,49 @@ describe('builtins/interpolation: ', () => {
expect(result).toEqual(outputs);
});

it('returns valid output parameter if input parameter is 0.', async () => {
const inputs = [
{
timestamp: '2023-07-06T00:00',
duration: 3600,
'cpu/utilization': 0,
},
];
const outputs = [
{
timestamp: '2023-07-06T00:00',
duration: 3600,
'cpu/utilization': 0,
'interpolation-result': 0.12,
},
];

const result = await plugin.execute(inputs);

expect(result).toEqual(outputs);
});

it('returns no output parameter if input parameter is `off`.', async () => {
const inputs = [
{
timestamp: '2023-07-06T00:00',
duration: 3600,
'cpu/utilization': 'off',
},
];
const outputs = [
{
timestamp: '2023-07-06T00:00',
duration: 3600,
'cpu/utilization': 0,
},
];

const result = await plugin.execute(inputs);

expect(result).toEqual(outputs);
});

it('returns result when `mapping` has valid data.', async () => {
const mapping = {
'cpu/utilization': 'cpu/util',
Expand Down

0 comments on commit 702b961

Please sign in to comment.