Skip to content

Commit 2a7f330

Browse files
committed
fix lint
1 parent 666492c commit 2a7f330

18 files changed

+34
-37
lines changed

src/__tests__/render-hook.test.tsx

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ReactNode } from 'react';
2-
import React from 'react';
3-
import TestRenderer from 'universal-test-renderer';
2+
import * as React from 'react';
3+
import * as UniversalTestRenderer from 'universal-test-renderer';
44

55
import { renderHook } from '../pure';
66

@@ -85,20 +85,19 @@ test('props type is inferred correctly when initial props is explicitly undefine
8585
expect(result.current.param).toBe(6);
8686
});
8787

88-
// TEMP
89-
// /**
90-
// * This test makes sure that calling renderHook does
91-
// * not try to detect host component names in any form.
92-
// * But since there are numerous methods that could trigger that
93-
// * we check the count of renders using React Test Renderers.
94-
// */
95-
// test('does render only once', () => {
96-
// jest.spyOn(TestRenderer, 'create');
97-
98-
// renderHook(() => {
99-
// const [state, setState] = React.useState(1);
100-
// return [state, setState];
101-
// });
102-
103-
// expect(TestRenderer.create).toHaveBeenCalledTimes(1);
104-
// });
88+
/**
89+
* This test makes sure that calling renderHook does
90+
* not try to detect host component names in any form.
91+
* But since there are numerous methods that could trigger that
92+
* we check the count of renders using React Test Renderers.
93+
*/
94+
test('does render only once', () => {
95+
jest.spyOn(UniversalTestRenderer, 'createRoot');
96+
97+
renderHook(() => {
98+
const [state, setState] = React.useState(1);
99+
return [state, setState];
100+
});
101+
102+
expect(UniversalTestRenderer.createRoot).toHaveBeenCalledTimes(1);
103+
});

src/act.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ type ReactAct = typeof React.act;
77

88
// See https://github.com/reactwg/react-18/discussions/102 for more context on global.IS_REACT_ACT_ENVIRONMENT
99
declare global {
10-
// eslint-disable-next-line no-var
1110
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;
1211
}
1312

src/fire-event.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import type {
88
import type { Fiber, HostElement } from 'universal-test-renderer';
99

1010
import act from './act';
11-
import { EventHandler, getEventHandlerFromProps } from './event-handler';
11+
import type { EventHandler } from './event-handler';
12+
import { getEventHandlerFromProps } from './event-handler';
1213
import { isElementMounted, isHostElement } from './helpers/component-tree';
1314
import { isHostScrollView, isHostTextInput } from './helpers/host-component-names';
1415
import { isPointerEventEnabled } from './helpers/pointer-events';

src/helpers/format-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HostElement, JsonNode } from 'universal-test-renderer';
21
import type { NewPlugin } from 'pretty-format';
32
import prettyFormat, { plugins } from 'pretty-format';
3+
import type { HostElement, JsonNode } from 'universal-test-renderer';
44

55
import type { MapPropsFunction } from './map-props';
66
import { defaultMapProps } from './map-props';

src/matchers/to-be-busy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HostElement } from 'universal-test-renderer';
21
import { matcherHint } from 'jest-matcher-utils';
32
import redent from 'redent';
3+
import type { HostElement } from 'universal-test-renderer';
44

55
import { computeAriaBusy } from '../helpers/accessibility';
66
import { formatElement } from '../helpers/format-element';

src/matchers/to-be-checked.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HostElement } from 'universal-test-renderer';
21
import { matcherHint } from 'jest-matcher-utils';
32
import redent from 'redent';
3+
import type { HostElement } from 'universal-test-renderer';
44

55
import {
66
computeAriaChecked,

src/matchers/to-be-expanded.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HostElement } from 'universal-test-renderer';
21
import { matcherHint } from 'jest-matcher-utils';
32
import redent from 'redent';
3+
import type { HostElement } from 'universal-test-renderer';
44

55
import { computeAriaExpanded } from '../helpers/accessibility';
66
import { formatElement } from '../helpers/format-element';

src/matchers/to-be-partially-checked.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HostElement } from 'universal-test-renderer';
21
import { matcherHint } from 'jest-matcher-utils';
32
import redent from 'redent';
3+
import type { HostElement } from 'universal-test-renderer';
44

55
import { computeAriaChecked, getRole, isAccessibilityElement } from '../helpers/accessibility';
66
import { ErrorWithStack } from '../helpers/errors';

src/matchers/to-be-selected.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HostElement } from 'universal-test-renderer';
21
import { matcherHint } from 'jest-matcher-utils';
32
import redent from 'redent';
3+
import type { HostElement } from 'universal-test-renderer';
44

55
import { computeAriaSelected } from '../helpers/accessibility';
66
import { formatElement } from '../helpers/format-element';

src/matchers/to-have-accessibility-value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { HostElement } from 'universal-test-renderer';
21
import { matcherHint, stringify } from 'jest-matcher-utils';
2+
import type { HostElement } from 'universal-test-renderer';
33

44
import { computeAriaValue } from '../helpers/accessibility';
55
import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';

0 commit comments

Comments
 (0)