Skip to content

Commit

Permalink
fix(HMS-3593): Added unit test cases for instance type selection
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshdubey-star authored and ezr-ondrej committed Mar 5, 2024
1 parent 9f3f38c commit 2cb4ed7
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/Components/InstanceTypesSelect/InstanceTypesSelect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,35 @@ describe('InstanceTypesSelect x86_64', () => {
const items = await screen.findAllByLabelText(/^Instance Type/);
expect(items).toHaveLength(1);
});
test('filter with a query', async () => {
const query = 'vcpus > 2 and cores > 2';
test('filter with a query greater than', async () => {
const query = 'vcpus > 2 and cores > 2 and memory > 1024';
const dropdown = await mountSelectAndClick();
await userEvent.type(dropdown, query);
const items = await screen.findAllByLabelText(/^Instance Type/);
expect(items).toHaveLength(1);
});
test('filter with a query less than', async () => {
const query = 'vcpus < 2 and cores < 2 and memory < 1024';
const dropdown = await mountSelectAndClick();
await userEvent.type(dropdown, query);
const items = await screen.findAllByLabelText(/^Instance Type/);
expect(items).toHaveLength(1);
});
test('filter with a query combination', async () => {
const query = 'vcpus < 3 and cores > 1 and memory = 1024';
const dropdown = await mountSelectAndClick();
await userEvent.type(dropdown, query);
const input = await screen.findByLabelText('Selected instance type');
expect(input).toBeInTheDocument();
});
test('filter with a query equal', async () => {
const query = 'vcpus = 2 and cores = 2 and memory = 1024';
const dropdown = await mountSelectAndClick();
await userEvent.type(dropdown, query);
const inputs = await screen.findAllByLabelText('Selected instance type');
expect(inputs.length).toBe(1);
expect(inputs[0]).toBeInTheDocument();
});
});
});

Expand Down

0 comments on commit 2cb4ed7

Please sign in to comment.