Skip to content

Commit feeae76

Browse files
committed
tweak tests
1 parent b2a79d4 commit feeae76

File tree

4 files changed

+0
-77
lines changed

4 files changed

+0
-77
lines changed

src/__tests__/config.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,3 @@ test('warns when unknown option is passed', () => {
7878
expect(warningMessage).toContain('Unknown option(s) passed to configure: unknownOption');
7979
expect(warningMessage).toContain('config.test.ts');
8080
});
81-
82-
test('warns when multiple unknown options are passed', () => {
83-
configure({ asyncUtilTimeout: 1000, unknown1: 'value1', unknown2: 'value2' } as any);
84-
85-
expect(_console.warn).toHaveBeenCalledTimes(1);
86-
const warningMessage = jest.mocked(_console.warn).mock.calls[0][0];
87-
expect(warningMessage).toContain('Unknown option(s) passed to configure: unknown1, unknown2');
88-
expect(warningMessage).toContain('config.test.ts');
89-
});
90-
91-
test('still configures correctly when unknown options are passed', () => {
92-
configure({ asyncUtilTimeout: 3000, unknownOption: 'value' } as any);
93-
94-
expect(_console.warn).toHaveBeenCalledTimes(1);
95-
expect(getConfig().asyncUtilTimeout).toBe(3000);
96-
});

src/__tests__/render-hook.test.tsx

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -323,26 +323,6 @@ test('does not warn when only valid options are passed', async () => {
323323
expect(_console.warn).not.toHaveBeenCalled();
324324
});
325325

326-
test('warns for unknown options but still passes valid options to render', async () => {
327-
const Context = React.createContext('default');
328-
329-
function useTestHook() {
330-
return React.useContext(Context);
331-
}
332-
333-
function Wrapper({ children }: { children: ReactNode }) {
334-
return <Context.Provider value="provided">{children}</Context.Provider>;
335-
}
336-
337-
const { result } = await renderHook(useTestHook, {
338-
wrapper: Wrapper,
339-
unknownOption: 'value',
340-
} as any);
341-
342-
expect(_console.warn).toHaveBeenCalledTimes(1);
343-
expect(result.current).toEqual('provided');
344-
});
345-
346326
test('warns when unknown option is passed', async () => {
347327
function useTestHook() {
348328
return React.useState(0);
@@ -355,16 +335,3 @@ test('warns when unknown option is passed', async () => {
355335
'Unknown option(s) passed to renderHook: unknownOption',
356336
);
357337
});
358-
359-
test('warns when multiple unknown options are passed', async () => {
360-
function useTestHook() {
361-
return React.useState(0);
362-
}
363-
364-
await renderHook(useTestHook, { unknown1: 'value1', unknown2: 'value2' } as any);
365-
366-
expect(_console.warn).toHaveBeenCalledTimes(1);
367-
expect(jest.mocked(_console.warn).mock.calls[0][0]).toContain(
368-
'Unknown option(s) passed to renderHook: unknown1, unknown2',
369-
);
370-
});

src/__tests__/render.test.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ test('warns when unknown option is passed', async () => {
5353
);
5454
});
5555

56-
test('warns when multiple unknown options are passed', async () => {
57-
const TestComponent = () => <Text testID="test">Test</Text>;
58-
59-
await render(<TestComponent />, { unknown1: 'value1', unknown2: 'value2' } as any);
60-
61-
expect(_console.warn).toHaveBeenCalledTimes(1);
62-
expect(jest.mocked(_console.warn).mock.calls[0][0]).toContain(
63-
'Unknown option(s) passed to render: unknown1, unknown2',
64-
);
65-
});
66-
6756
describe('render options', () => {
6857
test('renders component with wrapper option', async () => {
6958
const TestComponent = () => <Text testID="inner">Inner Content</Text>;

src/user-event/setup/__tests__/setup.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ test('creates instance with valid options', () => {
2424
expect(_console.warn).not.toHaveBeenCalled();
2525
});
2626

27-
test('creates instance correctly when unknown options are passed', () => {
28-
const instance = setup({ delay: 50, unknownOption: 'value' } as any);
29-
30-
expect(instance).toBeDefined();
31-
expect(instance.config.delay).toBe(50);
32-
expect(_console.warn).toHaveBeenCalledTimes(1);
33-
});
34-
3527
test('warns when unknown option is passed', () => {
3628
setup({ unknownOption: 'value' } as any);
3729

@@ -40,12 +32,3 @@ test('warns when unknown option is passed', () => {
4032
'Unknown option(s) passed to userEvent.setup: unknownOption',
4133
);
4234
});
43-
44-
test('warns when multiple unknown options are passed', () => {
45-
setup({ delay: 100, unknown1: 'value1', unknown2: 'value2' } as any);
46-
47-
expect(_console.warn).toHaveBeenCalledTimes(1);
48-
expect(jest.mocked(_console.warn).mock.calls[0][0]).toContain(
49-
'Unknown option(s) passed to userEvent.setup: unknown1, unknown2',
50-
);
51-
});

0 commit comments

Comments
 (0)