Skip to content

Commit d8c0ef0

Browse files
committed
[tests] Test for missing context
1 parent c795255 commit d8c0ef0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/unit/ui-react/hooks.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,24 @@ describe('Context Hooks', () => {
673673
expect(renderer.toJSON()).toEqual('["checkpoints1","checkpoints2"]');
674674
expect(didRender).toHaveBeenCalledTimes(1);
675675
});
676+
677+
test('No context', () => {
678+
const Test = () =>
679+
didRender(
680+
<>
681+
{JSON.stringify(useStoreIds())}
682+
{JSON.stringify(useMetricsIds())}
683+
{JSON.stringify(useIndexesIds())}
684+
{JSON.stringify(useRelationshipsIds())}
685+
{JSON.stringify(useQueriesIds())}
686+
</>,
687+
);
688+
act(() => {
689+
renderer = create(<Test />);
690+
});
691+
expect(renderer.toJSON()).toEqual(['[]', '[]', '[]', '[]', '[]']);
692+
expect(didRender).toHaveBeenCalledTimes(1);
693+
});
676694
});
677695

678696
describe('Read Hooks', () => {

0 commit comments

Comments
 (0)