Skip to content

Commit

Permalink
Merge pull request #3869 from dlabrecq/deps
Browse files Browse the repository at this point in the history
Dependency updates
  • Loading branch information
dlabrecq authored Jun 3, 2024
2 parents 0974bb1 + 601a47f commit 958286e
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 424 deletions.
442 changes: 140 additions & 302 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
"dependencies": {
"@patternfly/patternfly": "5.3.1",
"@patternfly/react-charts": "7.3.0",
"@patternfly/react-component-groups": "^5.1.0",
"@patternfly/react-component-groups": "^5.2.0",
"@patternfly/react-core": "5.3.3",
"@patternfly/react-icons": "5.3.2",
"@patternfly/react-table": "5.3.3",
"@patternfly/react-tokens": "5.3.1",
"@redhat-cloud-services/frontend-components": "^4.2.10",
"@redhat-cloud-services/frontend-components": "^4.2.11",
"@redhat-cloud-services/frontend-components-notifications": "^4.1.0",
"@redhat-cloud-services/frontend-components-translations": "^3.2.7",
"@redhat-cloud-services/frontend-components-utilities": "^4.0.11",
"@redhat-cloud-services/rbac-client": "^1.4.4",
"@redhat-cloud-services/rbac-client": "^1.4.5",
"@reduxjs/toolkit": "^2.2.5",
"@unleash/proxy-client-react": "^4.2.4",
"axios": "^1.7.2",
Expand All @@ -85,20 +85,20 @@
"@formatjs/icu-messageformat-parser": "^2.7.8",
"@redhat-cloud-services/eslint-config-redhat-cloud-services": "^2.0.4",
"@redhat-cloud-services/frontend-components-config": "^6.0.14",
"@redhat-cloud-services/tsc-transform-imports": "^1.0.10",
"@swc/core": "^1.5.7",
"@redhat-cloud-services/tsc-transform-imports": "^1.0.11",
"@swc/core": "^1.5.24",
"@swc/jest": "^0.2.36",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/qs": "^6.9.15",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-redux": "^7.1.33",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"aphrodite": "^2.4.0",
"copy-webpack-plugin": "^12.0.2",
"eslint": "^8.57.0",
Expand All @@ -120,7 +120,7 @@
"jest-transform-stub": "^2.0.0",
"jws": "^4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"prettier": "^3.3.0",
"rimraf": "^5.0.7",
"swc_mut_cjs_exports": "^0.90.24",
"ts-jest": "^29.1.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, render, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

Expand All @@ -16,9 +16,9 @@ test('primary selector', async () => {
expect(screen.queryAllByText('CPU').length).toBe(0);
expect(screen.queryAllByText('Memory').length).toBe(0);
const button = screen.getByRole('button');
await act(async () => user.click(button));
await user.click(button);
const menuItems = screen.getAllByRole('menuitem');
expect(menuItems.length).toBe(3);
await act(async () => user.click(menuItems[1]));
await user.click(menuItems[1]);
expect(handleOnClick.mock.calls).toEqual([['memory']]);
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, render, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

Expand All @@ -24,11 +24,11 @@ test('checkbox selector', async () => {
expect(screen.queryAllByText('CPU').length).toBe(0);
expect(screen.queryAllByText('Memory').length).toBe(0);
expect(screen.queryAllByText('Storage').length).toBe(0);
await act(async () => user.click(screen.getByRole('button')));
await user.click(screen.getByRole('button'));
expect(screen.queryAllByText('CPU').length).toBe(1);
expect(screen.queryAllByText('Memory').length).toBe(1);
expect(screen.queryAllByText('Storage').length).toBe(1);
expect(handleOnSelect.mock.calls.length).toBe(0);
await act(async () => user.click(screen.getAllByRole('checkbox')[0]));
await user.click(screen.getAllByRole('checkbox')[0]);
expect(handleOnSelect.mock.calls).toEqual([['cpu']]);
});
6 changes: 3 additions & 3 deletions src/routes/components/selectWrapper/selectWrapper.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, render, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

Expand All @@ -23,9 +23,9 @@ test('primary selector', async () => {
expect(screen.queryAllByText('CPU').length).toBe(1);
expect(screen.queryAllByText('Memory').length).toBe(0);
const button = screen.getByRole('button');
await act(async () => user.click(button));
await user.click(button);
const options = screen.getAllByRole('option');
expect(options.length).toBe(3);
await act(async () => user.click(options[1]));
await user.click(options[1]);
expect(handleOnSelect.mock.calls).toEqual([['memory']]);
});
118 changes: 59 additions & 59 deletions src/routes/settings/costModels/components/addPriceList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, configure, render, screen } from '@testing-library/react';
import { configure, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import type { Rate } from 'api/rates';
import messages from 'locales/messages';
Expand Down Expand Up @@ -124,67 +124,67 @@ describe('add-a-new-rate', () => {
let options = null;
render(<RenderFormDataUI submit={submit} cancel={cancel} />);

await act(async () => user.type(screen.getByLabelText('Description'), 'regular rate test'));
await user.type(screen.getByLabelText('Description'), 'regular rate test');

// select first option for metric
await act(async () => user.click(screen.getByLabelText('Select Metric')));
await user.click(screen.getByLabelText('Select Metric'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[0]));
await user.click(options[0]);

// select first option for measurement
await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[3])); // Previous select options are not being removed from page
await user.click(options[3]); // Previous select options are not being removed from page

// make sure the default cost type is selected
expect(screen.getByLabelText(qr.infraradio)).toHaveProperty('checked', true);

// selecting a different measurement does not reset cost type to default
await act(async () => user.click(screen.getByLabelText(qr.supplradio)));
await user.click(screen.getByLabelText(qr.supplradio));

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[1]));
await user.click(options[1]);

expect(screen.getByLabelText(qr.supplradio)).toHaveProperty('checked', true);

// selecting metric will reset both measurement and cost type
await act(async () => user.click(screen.getByLabelText(qr.infraradio)));
await user.click(screen.getByLabelText(qr.infraradio));

await act(async () => user.click(screen.getByLabelText('Select Metric')));
await user.click(screen.getByLabelText('Select Metric'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[1]));
await user.click(options[1]);

expect(screen.getByText(regExp(messages.costModelsRequiredField))).not.toBeNull();

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[3])); // Previous select options are not being removed from page
await user.click(options[3]); // Previous select options are not being removed from page

expect(screen.getByLabelText(qr.supplradio)).toHaveProperty('checked', true);
await act(async () => user.click(screen.getByLabelText(qr.infraradio)));
await user.click(screen.getByLabelText(qr.infraradio));

const rateInput = screen.getByLabelText('Assign rate');

// setting rate to anything but a number
expect(screen.queryByText(regExp(messages.priceListNumberRate))).toBeNull();
await act(async () => user.type(rateInput, 'A'));
await user.type(rateInput, 'A');
expect(screen.getByText(regExp(messages.priceListNumberRate))).not.toBeNull();

// setting rate to a negative number - validation is done on blur
await act(async () => user.clear(rateInput));
await act(async () => user.type(rateInput, '-12'));
await user.clear(rateInput);
await user.type(rateInput, '-12');
expect(screen.getByText(regExp(messages.priceListPosNumberRate))).not.toBeNull();

// setting rate to a valid number
await act(async () => user.clear(rateInput));
await act(async () => user.type(rateInput, '0.2'));
await user.clear(rateInput);
await user.type(rateInput, '0.2');
expect(screen.queryByText(regExp(messages.priceListNumberRate))).toBeNull();

// making sure button is enabled
const createButton = screen.getByText(regExp(messages.createRate));
expect(createButton.getAttribute('aria-disabled')).toBe('false');
await act(async () => user.click(createButton));
await user.click(createButton);
expect(submit).toHaveBeenCalled();
}, 10000);

Expand All @@ -196,68 +196,68 @@ describe('add-a-new-rate', () => {

render(<RenderFormDataUI submit={submit} cancel={cancel} />);

await act(async () => user.type(screen.getByLabelText('Description'), 'tag rate test'));
await user.type(screen.getByLabelText('Description'), 'tag rate test');

await act(async () => user.click(screen.getByLabelText('Select Metric')));
await user.click(screen.getByLabelText('Select Metric'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[0]));
await user.click(options[0]);

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[3])); // Previous select options are not being removed from page
await user.click(options[3]); // Previous select options are not being removed from page

await act(async () => user.click(screen.getByLabelText(regExp(messages.costModelsEnterTagRate))));
await user.click(screen.getByLabelText(regExp(messages.costModelsEnterTagRate)));

// tag key is required validation
const tagKeyInput = screen.getByPlaceholderText(qr.tagKeyPlaceHolder);
await act(async () => user.type(tagKeyInput, 'test'));
await user.type(tagKeyInput, 'test');
expect(screen.queryByText(regExp(messages.costModelsRequiredField))).toBeNull();
await act(async () => user.clear(tagKeyInput));
await user.clear(tagKeyInput);
expect(screen.getByText(regExp(messages.costModelsRequiredField))).not.toBeNull();
await act(async () => user.type(tagKeyInput, 'openshift'));
await user.type(tagKeyInput, 'openshift');
expect(screen.queryByText(regExp(messages.costModelsRequiredField))).toBeNull();

// tag value is required validation
const tagValueInput = screen.getByPlaceholderText('Enter a tag value');
await act(async () => user.type(tagValueInput, 'test'));
await user.type(tagValueInput, 'test');
expect(screen.queryByText(regExp(messages.costModelsRequiredField))).toBeNull();
await act(async () => user.clear(tagValueInput));
await user.clear(tagValueInput);
expect(screen.getByText(regExp(messages.costModelsRequiredField))).not.toBeNull();
await act(async () => user.type(tagValueInput, 'openshift'));
await user.type(tagValueInput, 'openshift');
expect(screen.queryByText(regExp(messages.costModelsRequiredField))).toBeNull();

// rate must be a number
const tagRateInput = screen.getByLabelText('Assign rate');
await act(async () => user.type(tagRateInput, 'test'));
await user.type(tagRateInput, 'test');
expect(screen.getByText(regExp(messages.priceListNumberRate))).not.toBeNull();

// rate is required
await act(async () => user.clear(tagRateInput));
await user.clear(tagRateInput);
expect(screen.getByText(regExp(messages.costModelsRequiredField))).not.toBeNull();

// rate must be positive
await act(async () => user.type(tagRateInput, '-0.23'));
await user.type(tagRateInput, '-0.23');
expect(screen.getByText(regExp(messages.priceListPosNumberRate))).not.toBeNull();

// setting a valid rate - now form is valid and can be submitted
const createButton = screen.getByText(regExp(messages.createRate));
expect(createButton.getAttribute('aria-disabled')).toBe('true');
await act(async () => user.clear(tagRateInput));
await user.clear(tagRateInput);

await act(async () => user.type(tagRateInput, '0.23'));
await act(async () => user.type(screen.getByPlaceholderText('Enter a tag description'), 'default worker'));
await user.type(tagRateInput, '0.23');
await user.type(screen.getByPlaceholderText('Enter a tag description'), 'default worker');
expect(createButton.getAttribute('aria-disabled')).toBe('false');

// set tag to default
await act(async () => user.click(screen.getByLabelText('Default')));
await user.click(screen.getByLabelText('Default'));

// add a new rate disables the submit button
await act(async () => user.click(screen.getByText(/add more tag values/i)));
await user.click(screen.getByText(/add more tag values/i));
expect(createButton.getAttribute('aria-disabled')).toBe('true');

await act(async () => user.click(screen.getAllByRole('button', { name: /remove tag value/i })[1]));
await user.click(screen.getAllByRole('button', { name: /remove tag value/i })[1]);
expect(createButton.getAttribute('aria-disabled')).toBe('false');
await act(async () => user.click(createButton));
await user.click(createButton);
expect(submit).toHaveBeenCalled();
}, 15000);

Expand All @@ -269,37 +269,37 @@ describe('add-a-new-rate', () => {

render(<RenderFormDataUI submit={submit} cancel={cancel} />);

await act(async () => user.click(screen.getByLabelText('Select Metric')));
await user.click(screen.getByLabelText('Select Metric'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[1]));
await user.click(options[1]);

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[3])); // Previous select options are not being removed from page
await user.click(options[3]); // Previous select options are not being removed from page

await act(async () => user.click(screen.getByLabelText(regExp(messages.costModelsEnterTagRate))));
await user.click(screen.getByLabelText(regExp(messages.costModelsEnterTagRate)));

// tag key is duplicated
const tagKeyInput = screen.getByPlaceholderText(qr.tagKeyPlaceHolder);
await act(async () => user.type(tagKeyInput, 'app'));
await user.type(tagKeyInput, 'app');
expect(screen.getByText(regExp(messages.priceListDuplicate))).not.toBeNull();

await act(async () => user.type(tagKeyInput, '1'));
await user.type(tagKeyInput, '1');
expect(screen.queryByText(regExp(messages.priceListDuplicate))).toBeNull();

// change measurement will set tag key as not duplicate
await act(async () => user.type(tagKeyInput, '{backspace}'));
await user.type(tagKeyInput, '{backspace}');
expect(screen.getByText(regExp(messages.priceListDuplicate))).not.toBeNull();

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[1]));
await user.click(options[1]);

expect(screen.queryByText(regExp(messages.priceListDuplicate))).toBeNull();

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[3]));
await user.click(options[3]);

expect(screen.getByText(regExp(messages.priceListDuplicate))).not.toBeNull();
});
Expand All @@ -312,13 +312,13 @@ describe('add-a-new-rate', () => {

await render(<RenderFormDataUI submit={submit} cancel={cancel} />);

await act(async () => user.click(screen.getByLabelText('Select Metric')));
await user.click(screen.getByLabelText('Select Metric'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[2]));
await user.click(options[2]);

await act(async () => user.click(screen.getByLabelText('Select Measurement')));
await user.click(screen.getByLabelText('Select Measurement'));
options = await screen.findAllByRole('option');
await act(async () => user.click(options[0]));
await user.click(options[0]);
expect(screen.queryAllByLabelText(regExp(messages.costModelsEnterTagRate))).toHaveLength(0);
});
});
Loading

0 comments on commit 958286e

Please sign in to comment.