Skip to content

Commit

Permalink
refactor: rename files (#1515)
Browse files Browse the repository at this point in the history
* refactor: rename files to match convention

* chore: refactor more

* chore: fix tests
  • Loading branch information
mdjastrzebski committed Oct 25, 2023
1 parent 28c8729 commit 3af4b8c
Show file tree
Hide file tree
Showing 61 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
preset: './jest-preset',
setupFilesAfterEnv: ['./jest-setup.ts'],
testPathIgnorePatterns: [
'timerUtils',
'timer-utils',
'examples/',
'experiments-app/',
'experiments-rtl/',
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/act.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Text } from 'react-native';
import act from '../act';
import render from '../render';
import fireEvent from '../fireEvent';
import fireEvent from '../fire-event';

type UseEffectProps = { callback(): void };
const UseEffect = ({ callback }: UseEffectProps) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/__tests__/timers.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import waitFor from '../waitFor';
import waitFor from '../wait-for';

describe.each([false, true])(
'fake timers tests (legacyFakeTimers = %s)',
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DebugOptions } from './helpers/debugDeep';
import { DebugOptions } from './helpers/debug-deep';

/**
* Global configuration options for React Native Testing Library.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { matchArrayProp } from '../matchArrayProp';
import { matchArrayProp } from '../match-array-prop';

test('returns true given 2 identical prop and matcher', () => {
expect(matchArrayProp(['banana'], ['banana'])).toEqual(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { matchObjectProp } from '../matchObjectProp';
import { matchObjectProp } from '../match-object-prop';

test('returns true given 2 identical objects', () => {
expect(matchObjectProp({ fruit: 'banana' }, { fruit: 'banana' })).toEqual(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { matchStringProp } from '../matchStringProp';
import { matchStringProp } from '../match-string-prop';

test.each`
prop | matcher | expectedResult
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactTestInstance } from 'react-test-renderer';
import { getAccessibilityValue } from '../accessiblity';
import { TextMatch } from '../../matches';
import { matchStringProp } from './matchStringProp';
import { matchStringProp } from './match-string-prop';

export interface AccessibilityValueMatcher {
min?: number;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
getAccessibilityLabel,
getAccessibilityLabelledBy,
} from '../accessiblity';
import { findAll } from '../findAll';
import { matchTextContent } from './matchTextContent';
import { findAll } from '../find-all';
import { matchTextContent } from './match-text-content';

export function matchLabelText(
root: ReactTestInstance,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/matchers/extend-expect.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StyleProp } from 'react-native';
import type { ReactTestInstance } from 'react-test-renderer';
import type { TextMatch, TextMatchOptions } from '../matches';
import type { AccessibilityValueMatcher } from '../helpers/matchers/accessibilityValue';
import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
import type { Style } from './to-have-style';

export interface JestNativeMatchers<R> {
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/to-have-accessibility-value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getAccessibilityValue } from '../helpers/accessiblity';
import {
AccessibilityValueMatcher,
matchAccessibilityValue,
} from '../helpers/matchers/accessibilityValue';
} from '../helpers/matchers/match-accessibility-value';
import { removeUndefinedKeys } from '../helpers/object';
import { checkHostElement, formatMessage } from './utils';

Expand Down
10 changes: 5 additions & 5 deletions src/pure.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export { default as act } from './act';
export { default as cleanup } from './cleanup';
export { default as fireEvent } from './fireEvent';
export { default as fireEvent } from './fire-event';
export { default as render } from './render';
export { default as waitFor } from './waitFor';
export { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';
export { default as waitFor } from './wait-for';
export { default as waitForElementToBeRemoved } from './wait-for-element-to-be-removed';
export { within, getQueriesForElement } from './within';

export { configure, resetToDefaults } from './config';
Expand All @@ -12,7 +12,7 @@ export {
isInaccessible,
} from './helpers/accessiblity';
export { getDefaultNormalizer } from './matches';
export { renderHook } from './renderHook';
export { renderHook } from './render-hook';
export { screen } from './screen';
export { userEvent } from './user-event';

Expand All @@ -22,6 +22,6 @@ export type {
RenderResult as RenderAPI,
DebugFunction,
} from './render';
export type { RenderHookOptions, RenderHookResult } from './renderHook';
export type { RenderHookOptions, RenderHookResult } from './render-hook';
export type { Config } from './config';
export type { UserEventConfig } from './user-event';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { accessibilityStateKeys } from '../helpers/accessiblity';
import { deprecateQueries } from '../helpers/deprecation';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import {
AccessibilityStateMatcher,
matchAccessibilityState,
} from '../helpers/matchers/accessibilityState';
import { makeQueries } from './makeQueries';
} from '../helpers/matchers/match-accessibility-state';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import { CommonQueryOptions } from './options';

const queryAllByA11yState = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { accessiblityValueKeys } from '../helpers/accessiblity';
import { deprecateQueries } from '../helpers/deprecation';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import {
AccessibilityValueMatcher,
matchAccessibilityValue,
} from '../helpers/matchers/accessibilityValue';
import { makeQueries } from './makeQueries';
} from '../helpers/matchers/match-accessibility-value';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import { CommonQueryOptions } from './options';

const queryAllByA11yValue = (
Expand Down
6 changes: 3 additions & 3 deletions src/queries/displayValue.ts → src/queries/display-value.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import { isHostTextInput } from '../helpers/host-component-names';
import { getTextInputValue } from '../helpers/text-input';
import { matches, TextMatch, TextMatchOptions } from '../matches';
import { makeQueries } from './makeQueries';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import type { CommonQueryOptions } from './options';

type ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;
Expand Down
6 changes: 3 additions & 3 deletions src/queries/hintText.ts → src/queries/hint-text.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import { matches, TextMatch, TextMatchOptions } from '../matches';
import { makeQueries } from './makeQueries';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import { CommonQueryOptions } from './options';

type ByHintTextOptions = CommonQueryOptions & TextMatchOptions;
Expand Down
8 changes: 4 additions & 4 deletions src/queries/labelText.ts → src/queries/label-text.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import { TextMatch, TextMatchOptions } from '../matches';
import { matchLabelText } from '../helpers/matchers/matchLabelText';
import { makeQueries } from './makeQueries';
import { matchLabelText } from '../helpers/matchers/match-label-text';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import { CommonQueryOptions } from './options';

type ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;
Expand Down
4 changes: 2 additions & 2 deletions src/queries/makeQueries.ts → src/queries/make-queries.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { ErrorWithStack } from '../helpers/errors';
import waitFor from '../waitFor';
import type { WaitForOptions } from '../waitFor';
import waitFor from '../wait-for';
import type { WaitForOptions } from '../wait-for';
import format from '../helpers/format';
import { screen } from '../screen';
import { defaultMapProps } from '../helpers/format-default';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import { matches, TextMatch, TextMatchOptions } from '../matches';
import { isHostTextInput } from '../helpers/host-component-names';
import { makeQueries } from './makeQueries';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import type { CommonQueryOptions } from './options';

type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;
Expand Down
12 changes: 6 additions & 6 deletions src/queries/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ import {
getAccessibilityRole,
isAccessibilityElement,
} from '../helpers/accessiblity';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import {
AccessibilityStateMatcher,
matchAccessibilityState,
} from '../helpers/matchers/accessibilityState';
} from '../helpers/matchers/match-accessibility-state';
import {
AccessibilityValueMatcher,
matchAccessibilityValue,
} from '../helpers/matchers/accessibilityValue';
import { matchStringProp } from '../helpers/matchers/matchStringProp';
} from '../helpers/matchers/match-accessibility-value';
import { matchStringProp } from '../helpers/matchers/match-string-prop';
import type { TextMatch } from '../matches';
import { getQueriesForElement } from '../within';
import { makeQueries } from './makeQueries';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import { CommonQueryOptions } from './options';

type ByRoleOptions = CommonQueryOptions &
Expand Down
6 changes: 3 additions & 3 deletions src/queries/testId.ts → src/queries/test-id.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import { matches, TextMatch, TextMatchOptions } from '../matches';
import { makeQueries } from './makeQueries';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import type { CommonQueryOptions } from './options';

type ByTestIdOptions = CommonQueryOptions & TextMatchOptions;
Expand Down
8 changes: 4 additions & 4 deletions src/queries/text.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { findAll } from '../helpers/findAll';
import { findAll } from '../helpers/find-all';
import { isHostText } from '../helpers/host-component-names';
import { matchTextContent } from '../helpers/matchers/matchTextContent';
import { matchTextContent } from '../helpers/matchers/match-text-content';
import { TextMatch, TextMatchOptions } from '../matches';
import { makeQueries } from './makeQueries';
import { makeQueries } from './make-queries';
import type {
FindAllByQuery,
FindByQuery,
GetAllByQuery,
GetByQuery,
QueryAllByQuery,
QueryByQuery,
} from './makeQueries';
} from './make-queries';
import type { CommonQueryOptions } from './options';

type ByTextOptions = CommonQueryOptions & TextMatchOptions;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import act from './act';
import { addToCleanupQueue } from './cleanup';
import { getConfig } from './config';
import { getHostChildren } from './helpers/component-tree';
import debugDeep, { DebugOptions } from './helpers/debugDeep';
import debugShallow from './helpers/debugShallow';
import debugDeep, { DebugOptions } from './helpers/debug-deep';
import debugShallow from './helpers/debug-shallow';
import { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';
import { validateStringsRenderedWithinText } from './helpers/stringValidation';
import { validateStringsRenderedWithinText } from './helpers/string-validation';
import { renderWithAct } from './render-act';
import { setRenderResult, screen } from './screen';
import { getQueriesForElement } from './within';
Expand Down
2 changes: 1 addition & 1 deletion src/user-event/scroll/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { ScrollToOptions, scrollTo } from './scrollTo';
export { ScrollToOptions, scrollTo } from './scroll-to';
File renamed without changes.
2 changes: 1 addition & 1 deletion src/user-event/type/__tests__/parseKeys.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseKeys } from '../parseKeys';
import { parseKeys } from '../parse-keys';

test('parseKeys', () => {
expect(parseKeys('')).toEqual([]);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/user-event/type/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isTextInputEditable } from '../../helpers/text-input';
import { isPointerEventEnabled } from '../../helpers/pointer-events';
import { UserEventConfig, UserEventInstance } from '../setup';
import { dispatchEvent, wait, getTextContentSize } from '../utils';
import { parseKeys } from './parseKeys';
import { parseKeys } from './parse-keys';

export interface TypeOptions {
skipPress?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import waitFor from './waitFor';
import type { WaitForOptions } from './waitFor';
import waitFor from './wait-for';
import type { WaitForOptions } from './wait-for';
import { ErrorWithStack } from './helpers/errors';

function isRemoved<T>(result: T): boolean {
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions src/within.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { ReactTestInstance } from 'react-test-renderer';
import { bindByTextQueries } from './queries/text';
import { bindByTestIdQueries } from './queries/testId';
import { bindByDisplayValueQueries } from './queries/displayValue';
import { bindByPlaceholderTextQueries } from './queries/placeholderText';
import { bindByLabelTextQueries } from './queries/labelText';
import { bindByHintTextQueries } from './queries/hintText';
import { bindByTestIdQueries } from './queries/test-id';
import { bindByDisplayValueQueries } from './queries/display-value';
import { bindByPlaceholderTextQueries } from './queries/placeholder-text';
import { bindByLabelTextQueries } from './queries/label-text';
import { bindByHintTextQueries } from './queries/hint-text';
import { bindByRoleQueries } from './queries/role';
import { bindByA11yStateQueries } from './queries/a11yState';
import { bindByA11yValueQueries } from './queries/a11yValue';
import { bindUnsafeByTypeQueries } from './queries/unsafeType';
import { bindUnsafeByPropsQueries } from './queries/unsafeProps';
import { bindByA11yStateQueries } from './queries/accessibility-state';
import { bindByA11yValueQueries } from './queries/accessibility-value';
import { bindUnsafeByTypeQueries } from './queries/unsafe-type';
import { bindUnsafeByPropsQueries } from './queries/unsafe-props';

export function within(instance: ReactTestInstance) {
return {
Expand Down

0 comments on commit 3af4b8c

Please sign in to comment.