Skip to content

Commit

Permalink
Merge branch 'dev' into da_CORE-310_workflowCostEstimates
Browse files Browse the repository at this point in the history
  • Loading branch information
davidangb authored Feb 19, 2025
2 parents fcc606a + e8c395a commit 158deed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/workspaces/workspace/workflows/WorkflowView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ export const WorkflowView = _.flow(
min: 0.01,
max: 9999999999.99,
placeholder: 'Example: 1.00',
onChange: (v) => this.setState({ perWorkflowCostCap: v ? v.toFixed(2) : undefined }),
onChange: (v) => this.setState({ perWorkflowCostCap: v ? v.toFixed(2) : '' }),
style: { fontSize: 12, marginTop: '0.5rem', width: '100%', marginLeft: '0.1rem' },
}),
]),
Expand Down
28 changes: 28 additions & 0 deletions src/pages/workspaces/workspace/workflows/WorkflowView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,4 +694,32 @@ describe('Workflow View (GCP)', () => {
// check that workflow cost capping is shown
expect(screen.queryByText('Set cost limit per workflow (BETA)')).not.toBeNull();
});

it('updates perWorkflowCostCap state on input change', async () => {
// Arrange
asMockedFn(isFeaturePreviewEnabled).mockReturnValue(true);

const user = userEvent.setup();
const namespace = 'gatk';
const name = 'echo_to_file-configured';

mockDefaultAjax();

// Act
await act(async () => {
render(h(WorkflowView, { name, namespace, queryParams: { selectionKey } }));
});

const costCapInput = screen.getByPlaceholderText('Example: 1.00');
expect(costCapInput).toBeInTheDocument();

// Assert initial state
expect(costCapInput).toHaveValue(null);

// Act
await user.type(costCapInput, '123.456');

// Assert updated state
expect(Number(costCapInput.value)).toBeCloseTo(123.456, 2);
});
});

0 comments on commit 158deed

Please sign in to comment.