Skip to content

Commit 6913af8

Browse files
committed
fix: adjusted tests with new filter change
Signed-off-by: Brian <[email protected]>
1 parent 90cfdcf commit 6913af8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/frontend/src/lib/select/InferenceRuntimeSelect.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import { render, fireEvent, within } from '@testing-library/svelte';
2222
import InferenceRuntimeSelect from '/@/lib/select/InferenceRuntimeSelect.svelte';
2323
import { InferenceType } from '@shared/models/IInference';
2424

25-
const getExpectedOptions = (): InferenceType[] => Object.values(InferenceType).filter(t => t !== InferenceType.NONE);
25+
const getFilteredOptions = (exclude: InferenceType[] = []): InferenceType[] =>
26+
Object.values(InferenceType).filter(type => !exclude.includes(type));
2627

2728
beforeEach(() => {
2829
// mock scrollIntoView
@@ -39,7 +40,7 @@ test('Lists all runtime options', async () => {
3940
await fireEvent.pointerUp(input);
4041

4142
const items = container.querySelectorAll('div[class~="list-item"]');
42-
const expectedOptions = getExpectedOptions();
43+
const expectedOptions = getFilteredOptions();
4344

4445
expect(items.length).toBe(expectedOptions.length);
4546

@@ -58,7 +59,7 @@ test('Selected value should be visible', async () => {
5859
await fireEvent.pointerUp(input);
5960

6061
const items = container.querySelectorAll('div[class~="list-item"]');
61-
const expectedOptions = getExpectedOptions();
62+
const expectedOptions = getFilteredOptions();
6263

6364
await fireEvent.click(items[0]);
6465

@@ -88,9 +89,9 @@ test('Exclude specific runtime from list', async () => {
8889
expect(itemTexts).not.toContain(excludedType);
8990
});
9091

91-
const includedTypes = Object.values(InferenceType).filter(t => t !== InferenceType.NONE && !excluded.includes(t));
92+
const expected = getFilteredOptions(excluded);
9293

93-
includedTypes.forEach(included => {
94+
expected.forEach(included => {
9495
expect(itemTexts).toContain(included);
9596
});
9697
});

0 commit comments

Comments
 (0)