apply suggested changes

Signed-off-by: Paul Schultz <pschultz@pobox.com>
This commit is contained in:
Paul Schultz
2024-12-11 22:24:08 -06:00
parent d14b4a77c5
commit 3a9ab1f0a9
3 changed files with 17 additions and 17 deletions
@@ -55,9 +55,7 @@ describe('ApiProvider', () => {
<MyHocConsumer />
</ApiProvider>,
);
expect(renderedHoc.getByText('hoc message: hello').innerHTML).toEqual(
'hoc message: hello',
);
expect(renderedHoc.getByText('hoc message: hello')).toBeInTheDocument();
});
it('should provide nested access to apis', () => {
@@ -86,7 +84,7 @@ describe('ApiProvider', () => {
</ApiProvider>
</ApiProvider>,
);
expect(renderedHook.getByText('a=z b=y').innerHTML).toEqual('a=z b=y');
expect(renderedHook.getByText('a=z b=y')).toBeInTheDocument();
});
it('should ignore deps in prototype', () => {
@@ -109,9 +107,7 @@ describe('ApiProvider', () => {
<MyWeirdHocConsumer />
</ApiProvider>,
);
expect(renderedHoc.getByText('hoc message: hello').innerHTML).toEqual(
'hoc message: hello',
);
expect(renderedHoc.getByText('hoc message: hello')).toBeInTheDocument();
});
it('should error if no provider is available', () => {
@@ -233,8 +229,6 @@ describe('v1 consumer', () => {
<MyHookConsumerV1 />
</ApiProvider>,
);
expect(renderedHook.getByText('hook message: hello').innerHTML).toEqual(
'hook message: hello',
);
expect(renderedHook.getByText('hook message: hello')).toBeInTheDocument();
});
});
@@ -34,10 +34,12 @@ describe('<CodeSnippet />', () => {
// react-syntax-highlighter is large and can cause significant slowdowns
// This test makes sure we're loading things in asynchronously and not too broadly.
it('renders quickly', async () => {
await expect(
renderInTestApp(<CodeSnippet text="" language="javascript" />),
).resolves.not.toThrow();
}, 1000);
const start = new Date();
await renderInTestApp(<CodeSnippet text="" language="javascript" />);
const end = new Date();
expect(end.getTime() - start.getTime()).toBeLessThanOrEqual(1000);
}, 1500);
it('renders text without exploding', async () => {
const { getByText } = await renderInTestApp(<CodeSnippet {...minProps} />);
@@ -22,9 +22,13 @@ import userEvent from '@testing-library/user-event';
describe('<ComponentContextMenu />', () => {
it('renders without any items and without exploding', async () => {
await expect(
renderInTestApp(<HeaderActionMenu actionItems={[]} />),
).resolves.not.toThrow();
const rendered = await renderInTestApp(
<HeaderActionMenu actionItems={[]} />,
);
expect(
rendered.queryByTestId('header-action-item'),
).not.toBeInTheDocument();
});
it('can open the menu and click menu items', async () => {