Skip to content

Commit 3af4b8c

Browse files
refactor: rename files (#1515)
* refactor: rename files to match convention * chore: refactor more * chore: fix tests
1 parent 28c8729 commit 3af4b8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+70
-70
lines changed

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
preset: './jest-preset',
33
setupFilesAfterEnv: ['./jest-setup.ts'],
44
testPathIgnorePatterns: [
5-
'timerUtils',
5+
'timer-utils',
66
'examples/',
77
'experiments-app/',
88
'experiments-rtl/',

src/__tests__/act.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import { Text } from 'react-native';
33
import act from '../act';
44
import render from '../render';
5-
import fireEvent from '../fireEvent';
5+
import fireEvent from '../fire-event';
66

77
type UseEffectProps = { callback(): void };
88
const UseEffect = ({ callback }: UseEffectProps) => {
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/__tests__/timers.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import waitFor from '../waitFor';
1+
import waitFor from '../wait-for';
22

33
describe.each([false, true])(
44
'fake timers tests (legacyFakeTimers = %s)',
File renamed without changes.

src/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DebugOptions } from './helpers/debugDeep';
1+
import { DebugOptions } from './helpers/debug-deep';
22

33
/**
44
* Global configuration options for React Native Testing Library.

src/fireEvent.ts src/fire-event.ts

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/helpers/matchers/__tests__/matchArrayValue.test.ts src/helpers/matchers/__tests__/match-array-value.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { matchArrayProp } from '../matchArrayProp';
1+
import { matchArrayProp } from '../match-array-prop';
22

33
test('returns true given 2 identical prop and matcher', () => {
44
expect(matchArrayProp(['banana'], ['banana'])).toEqual(true);

src/helpers/matchers/__tests__/matchObject.test.ts src/helpers/matchers/__tests__/match-object.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { matchObjectProp } from '../matchObjectProp';
1+
import { matchObjectProp } from '../match-object-prop';
22

33
test('returns true given 2 identical objects', () => {
44
expect(matchObjectProp({ fruit: 'banana' }, { fruit: 'banana' })).toEqual(

src/helpers/matchers/__tests__/matchStringValue.test.ts src/helpers/matchers/__tests__/match-string-value.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { matchStringProp } from '../matchStringProp';
1+
import { matchStringProp } from '../match-string-prop';
22

33
test.each`
44
prop | matcher | expectedResult

src/helpers/matchers/accessibilityValue.ts src/helpers/matchers/match-accessibility-value.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ReactTestInstance } from 'react-test-renderer';
22
import { getAccessibilityValue } from '../accessiblity';
33
import { TextMatch } from '../../matches';
4-
import { matchStringProp } from './matchStringProp';
4+
import { matchStringProp } from './match-string-prop';
55

66
export interface AccessibilityValueMatcher {
77
min?: number;

src/helpers/matchers/matchLabelText.ts src/helpers/matchers/match-label-text.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
getAccessibilityLabel,
55
getAccessibilityLabelledBy,
66
} from '../accessiblity';
7-
import { findAll } from '../findAll';
8-
import { matchTextContent } from './matchTextContent';
7+
import { findAll } from '../find-all';
8+
import { matchTextContent } from './match-text-content';
99

1010
export function matchLabelText(
1111
root: ReactTestInstance,
File renamed without changes.

src/matchers/extend-expect.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StyleProp } from 'react-native';
22
import type { ReactTestInstance } from 'react-test-renderer';
33
import type { TextMatch, TextMatchOptions } from '../matches';
4-
import type { AccessibilityValueMatcher } from '../helpers/matchers/accessibilityValue';
4+
import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
55
import type { Style } from './to-have-style';
66

77
export interface JestNativeMatchers<R> {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getAccessibilityValue } from '../helpers/accessiblity';
44
import {
55
AccessibilityValueMatcher,
66
matchAccessibilityValue,
7-
} from '../helpers/matchers/accessibilityValue';
7+
} from '../helpers/matchers/match-accessibility-value';
88
import { removeUndefinedKeys } from '../helpers/object';
99
import { checkHostElement, formatMessage } from './utils';
1010

src/pure.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export { default as act } from './act';
22
export { default as cleanup } from './cleanup';
3-
export { default as fireEvent } from './fireEvent';
3+
export { default as fireEvent } from './fire-event';
44
export { default as render } from './render';
5-
export { default as waitFor } from './waitFor';
6-
export { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';
5+
export { default as waitFor } from './wait-for';
6+
export { default as waitForElementToBeRemoved } from './wait-for-element-to-be-removed';
77
export { within, getQueriesForElement } from './within';
88

99
export { configure, resetToDefaults } from './config';
@@ -12,7 +12,7 @@ export {
1212
isInaccessible,
1313
} from './helpers/accessiblity';
1414
export { getDefaultNormalizer } from './matches';
15-
export { renderHook } from './renderHook';
15+
export { renderHook } from './render-hook';
1616
export { screen } from './screen';
1717
export { userEvent } from './user-event';
1818

@@ -22,6 +22,6 @@ export type {
2222
RenderResult as RenderAPI,
2323
DebugFunction,
2424
} from './render';
25-
export type { RenderHookOptions, RenderHookResult } from './renderHook';
25+
export type { RenderHookOptions, RenderHookResult } from './render-hook';
2626
export type { Config } from './config';
2727
export type { UserEventConfig } from './user-event';
File renamed without changes.

src/queries/a11yState.ts src/queries/accessibility-state.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
22
import { accessibilityStateKeys } from '../helpers/accessiblity';
33
import { deprecateQueries } from '../helpers/deprecation';
4-
import { findAll } from '../helpers/findAll';
4+
import { findAll } from '../helpers/find-all';
55
import {
66
AccessibilityStateMatcher,
77
matchAccessibilityState,
8-
} from '../helpers/matchers/accessibilityState';
9-
import { makeQueries } from './makeQueries';
8+
} from '../helpers/matchers/match-accessibility-state';
9+
import { makeQueries } from './make-queries';
1010
import type {
1111
FindAllByQuery,
1212
FindByQuery,
1313
GetAllByQuery,
1414
GetByQuery,
1515
QueryAllByQuery,
1616
QueryByQuery,
17-
} from './makeQueries';
17+
} from './make-queries';
1818
import { CommonQueryOptions } from './options';
1919

2020
const queryAllByA11yState = (

src/queries/a11yValue.ts src/queries/accessibility-value.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
22
import { accessiblityValueKeys } from '../helpers/accessiblity';
33
import { deprecateQueries } from '../helpers/deprecation';
4-
import { findAll } from '../helpers/findAll';
4+
import { findAll } from '../helpers/find-all';
55
import {
66
AccessibilityValueMatcher,
77
matchAccessibilityValue,
8-
} from '../helpers/matchers/accessibilityValue';
9-
import { makeQueries } from './makeQueries';
8+
} from '../helpers/matchers/match-accessibility-value';
9+
import { makeQueries } from './make-queries';
1010
import type {
1111
FindAllByQuery,
1212
FindByQuery,
1313
GetAllByQuery,
1414
GetByQuery,
1515
QueryAllByQuery,
1616
QueryByQuery,
17-
} from './makeQueries';
17+
} from './make-queries';
1818
import { CommonQueryOptions } from './options';
1919

2020
const queryAllByA11yValue = (

src/queries/displayValue.ts src/queries/display-value.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
2-
import { findAll } from '../helpers/findAll';
2+
import { findAll } from '../helpers/find-all';
33
import { isHostTextInput } from '../helpers/host-component-names';
44
import { getTextInputValue } from '../helpers/text-input';
55
import { matches, TextMatch, TextMatchOptions } from '../matches';
6-
import { makeQueries } from './makeQueries';
6+
import { makeQueries } from './make-queries';
77
import type {
88
FindAllByQuery,
99
FindByQuery,
1010
GetAllByQuery,
1111
GetByQuery,
1212
QueryAllByQuery,
1313
QueryByQuery,
14-
} from './makeQueries';
14+
} from './make-queries';
1515
import type { CommonQueryOptions } from './options';
1616

1717
type ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;

src/queries/hintText.ts src/queries/hint-text.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
2-
import { findAll } from '../helpers/findAll';
2+
import { findAll } from '../helpers/find-all';
33
import { matches, TextMatch, TextMatchOptions } from '../matches';
4-
import { makeQueries } from './makeQueries';
4+
import { makeQueries } from './make-queries';
55
import type {
66
FindAllByQuery,
77
FindByQuery,
88
GetAllByQuery,
99
GetByQuery,
1010
QueryAllByQuery,
1111
QueryByQuery,
12-
} from './makeQueries';
12+
} from './make-queries';
1313
import { CommonQueryOptions } from './options';
1414

1515
type ByHintTextOptions = CommonQueryOptions & TextMatchOptions;

src/queries/labelText.ts src/queries/label-text.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
2-
import { findAll } from '../helpers/findAll';
2+
import { findAll } from '../helpers/find-all';
33
import { TextMatch, TextMatchOptions } from '../matches';
4-
import { matchLabelText } from '../helpers/matchers/matchLabelText';
5-
import { makeQueries } from './makeQueries';
4+
import { matchLabelText } from '../helpers/matchers/match-label-text';
5+
import { makeQueries } from './make-queries';
66
import type {
77
FindAllByQuery,
88
FindByQuery,
99
GetAllByQuery,
1010
GetByQuery,
1111
QueryAllByQuery,
1212
QueryByQuery,
13-
} from './makeQueries';
13+
} from './make-queries';
1414
import { CommonQueryOptions } from './options';
1515

1616
type ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;

src/queries/makeQueries.ts src/queries/make-queries.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
22
import { ErrorWithStack } from '../helpers/errors';
3-
import waitFor from '../waitFor';
4-
import type { WaitForOptions } from '../waitFor';
3+
import waitFor from '../wait-for';
4+
import type { WaitForOptions } from '../wait-for';
55
import format from '../helpers/format';
66
import { screen } from '../screen';
77
import { defaultMapProps } from '../helpers/format-default';

src/queries/placeholderText.ts src/queries/placeholder-text.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
2-
import { findAll } from '../helpers/findAll';
2+
import { findAll } from '../helpers/find-all';
33
import { matches, TextMatch, TextMatchOptions } from '../matches';
44
import { isHostTextInput } from '../helpers/host-component-names';
5-
import { makeQueries } from './makeQueries';
5+
import { makeQueries } from './make-queries';
66
import type {
77
FindAllByQuery,
88
FindByQuery,
99
GetAllByQuery,
1010
GetByQuery,
1111
QueryAllByQuery,
1212
QueryByQuery,
13-
} from './makeQueries';
13+
} from './make-queries';
1414
import type { CommonQueryOptions } from './options';
1515

1616
type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;

src/queries/role.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ import {
55
getAccessibilityRole,
66
isAccessibilityElement,
77
} from '../helpers/accessiblity';
8-
import { findAll } from '../helpers/findAll';
8+
import { findAll } from '../helpers/find-all';
99
import {
1010
AccessibilityStateMatcher,
1111
matchAccessibilityState,
12-
} from '../helpers/matchers/accessibilityState';
12+
} from '../helpers/matchers/match-accessibility-state';
1313
import {
1414
AccessibilityValueMatcher,
1515
matchAccessibilityValue,
16-
} from '../helpers/matchers/accessibilityValue';
17-
import { matchStringProp } from '../helpers/matchers/matchStringProp';
16+
} from '../helpers/matchers/match-accessibility-value';
17+
import { matchStringProp } from '../helpers/matchers/match-string-prop';
1818
import type { TextMatch } from '../matches';
1919
import { getQueriesForElement } from '../within';
20-
import { makeQueries } from './makeQueries';
20+
import { makeQueries } from './make-queries';
2121
import type {
2222
FindAllByQuery,
2323
FindByQuery,
2424
GetAllByQuery,
2525
GetByQuery,
2626
QueryAllByQuery,
2727
QueryByQuery,
28-
} from './makeQueries';
28+
} from './make-queries';
2929
import { CommonQueryOptions } from './options';
3030

3131
type ByRoleOptions = CommonQueryOptions &

src/queries/testId.ts src/queries/test-id.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
2-
import { findAll } from '../helpers/findAll';
2+
import { findAll } from '../helpers/find-all';
33
import { matches, TextMatch, TextMatchOptions } from '../matches';
4-
import { makeQueries } from './makeQueries';
4+
import { makeQueries } from './make-queries';
55
import type {
66
FindAllByQuery,
77
FindByQuery,
88
GetAllByQuery,
99
GetByQuery,
1010
QueryAllByQuery,
1111
QueryByQuery,
12-
} from './makeQueries';
12+
} from './make-queries';
1313
import type { CommonQueryOptions } from './options';
1414

1515
type ByTestIdOptions = CommonQueryOptions & TextMatchOptions;

src/queries/text.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
2-
import { findAll } from '../helpers/findAll';
2+
import { findAll } from '../helpers/find-all';
33
import { isHostText } from '../helpers/host-component-names';
4-
import { matchTextContent } from '../helpers/matchers/matchTextContent';
4+
import { matchTextContent } from '../helpers/matchers/match-text-content';
55
import { TextMatch, TextMatchOptions } from '../matches';
6-
import { makeQueries } from './makeQueries';
6+
import { makeQueries } from './make-queries';
77
import type {
88
FindAllByQuery,
99
FindByQuery,
1010
GetAllByQuery,
1111
GetByQuery,
1212
QueryAllByQuery,
1313
QueryByQuery,
14-
} from './makeQueries';
14+
} from './make-queries';
1515
import type { CommonQueryOptions } from './options';
1616

1717
type ByTextOptions = CommonQueryOptions & TextMatchOptions;
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/render.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import act from './act';
55
import { addToCleanupQueue } from './cleanup';
66
import { getConfig } from './config';
77
import { getHostChildren } from './helpers/component-tree';
8-
import debugDeep, { DebugOptions } from './helpers/debugDeep';
9-
import debugShallow from './helpers/debugShallow';
8+
import debugDeep, { DebugOptions } from './helpers/debug-deep';
9+
import debugShallow from './helpers/debug-shallow';
1010
import { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';
11-
import { validateStringsRenderedWithinText } from './helpers/stringValidation';
11+
import { validateStringsRenderedWithinText } from './helpers/string-validation';
1212
import { renderWithAct } from './render-act';
1313
import { setRenderResult, screen } from './screen';
1414
import { getQueriesForElement } from './within';

src/user-event/scroll/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { ScrollToOptions, scrollTo } from './scrollTo';
1+
export { ScrollToOptions, scrollTo } from './scroll-to';
File renamed without changes.

src/user-event/type/__tests__/parseKeys.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parseKeys } from '../parseKeys';
1+
import { parseKeys } from '../parse-keys';
22

33
test('parseKeys', () => {
44
expect(parseKeys('')).toEqual([]);
File renamed without changes.

src/user-event/type/type.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { isTextInputEditable } from '../../helpers/text-input';
66
import { isPointerEventEnabled } from '../../helpers/pointer-events';
77
import { UserEventConfig, UserEventInstance } from '../setup';
88
import { dispatchEvent, wait, getTextContentSize } from '../utils';
9-
import { parseKeys } from './parseKeys';
9+
import { parseKeys } from './parse-keys';
1010

1111
export interface TypeOptions {
1212
skipPress?: boolean;

src/waitForElementToBeRemoved.ts src/wait-for-element-to-be-removed.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import waitFor from './waitFor';
2-
import type { WaitForOptions } from './waitFor';
1+
import waitFor from './wait-for';
2+
import type { WaitForOptions } from './wait-for';
33
import { ErrorWithStack } from './helpers/errors';
44

55
function isRemoved<T>(result: T): boolean {

src/waitFor.ts src/wait-for.ts

File renamed without changes.

src/within.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { ReactTestInstance } from 'react-test-renderer';
22
import { bindByTextQueries } from './queries/text';
3-
import { bindByTestIdQueries } from './queries/testId';
4-
import { bindByDisplayValueQueries } from './queries/displayValue';
5-
import { bindByPlaceholderTextQueries } from './queries/placeholderText';
6-
import { bindByLabelTextQueries } from './queries/labelText';
7-
import { bindByHintTextQueries } from './queries/hintText';
3+
import { bindByTestIdQueries } from './queries/test-id';
4+
import { bindByDisplayValueQueries } from './queries/display-value';
5+
import { bindByPlaceholderTextQueries } from './queries/placeholder-text';
6+
import { bindByLabelTextQueries } from './queries/label-text';
7+
import { bindByHintTextQueries } from './queries/hint-text';
88
import { bindByRoleQueries } from './queries/role';
9-
import { bindByA11yStateQueries } from './queries/a11yState';
10-
import { bindByA11yValueQueries } from './queries/a11yValue';
11-
import { bindUnsafeByTypeQueries } from './queries/unsafeType';
12-
import { bindUnsafeByPropsQueries } from './queries/unsafeProps';
9+
import { bindByA11yStateQueries } from './queries/accessibility-state';
10+
import { bindByA11yValueQueries } from './queries/accessibility-value';
11+
import { bindUnsafeByTypeQueries } from './queries/unsafe-type';
12+
import { bindUnsafeByPropsQueries } from './queries/unsafe-props';
1313

1414
export function within(instance: ReactTestInstance) {
1515
return {

0 commit comments

Comments
 (0)