Skip to content

Commit

Permalink
refactor: rename method makeQuery to makeA11yQuery
Browse files Browse the repository at this point in the history
the renaming is done to avoid any confusion with makeQueries which should be the new way to add new queries
  • Loading branch information
MattAgn authored and thymikee committed Feb 5, 2021
1 parent 8b917e2 commit acbf466
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/helpers/a11yAPI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import type { A11yRole, A11yStates, A11yState, A11yValue } from '../types.flow';
import type { WaitForOptions } from '../waitFor';
import makeQuery from './makeQuery';
import makeA11yQuery from './makeA11yQuery';

type GetReturn = ReactTestInstance;
type GetAllReturn = Array<ReactTestInstance>;
Expand Down Expand Up @@ -118,7 +118,7 @@ export function matchObject<T: {}>(prop?: T, matcher: T): boolean {

export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
({
...makeQuery(
...makeA11yQuery(
'accessibilityLabel',
{
getBy: ['getByA11yLabel', 'getByAccessibilityLabel', 'getByLabelText'],
Expand Down Expand Up @@ -150,7 +150,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
},
matchStringValue
)(instance),
...makeQuery(
...makeA11yQuery(
'accessibilityHint',
{
getBy: ['getByA11yHint', 'getByAccessibilityHint', 'getByHintText'],
Expand Down Expand Up @@ -178,7 +178,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
},
matchStringValue
)(instance),
...makeQuery(
...makeA11yQuery(
'accessibilityRole',
{
getBy: ['getByA11yRole', 'getByAccessibilityRole', 'getByRole'],
Expand All @@ -202,7 +202,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
},
matchStringValue
)(instance),
...makeQuery(
...makeA11yQuery(
'accessibilityStates',
{
getBy: ['getByA11yStates', 'getByAccessibilityStates'],
Expand All @@ -214,7 +214,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
},
matchArrayValue
)(instance),
...makeQuery(
...makeA11yQuery(
'accessibilityState',
{
getBy: ['getByA11yState', 'getByAccessibilityState'],
Expand All @@ -226,7 +226,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
},
matchObject
)(instance),
...makeQuery(
...makeA11yQuery(
'accessibilityValue',
{
getBy: ['getByA11yValue', 'getByAccessibilityValue'],
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/makeQuery.js → src/helpers/makeA11yQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type QueryNames = {
findAllBy: Array<string>,
};

const makeQuery = <P: mixed, M: mixed>(
const makeA11yQuery = <P: mixed, M: mixed>(
name: string,
queryNames: QueryNames,
matcherFn: (prop: P, value: M) => boolean
Expand Down Expand Up @@ -95,4 +95,4 @@ const makeQuery = <P: mixed, M: mixed>(
};
};

export default makeQuery;
export default makeA11yQuery;

0 comments on commit acbf466

Please sign in to comment.