Skip to content

Commit f59aa34

Browse files
committed
pref: use flatMap to build query list
1 parent a36ed51 commit f59aa34

File tree

1 file changed

+18
-49
lines changed

1 file changed

+18
-49
lines changed

src/queries.js

+18-49
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,22 @@
11
let theQueries = [
2-
"findAllByLabelText",
3-
"findByLabelText",
4-
"getAllByLabelText",
5-
"getByLabelText",
6-
"queryAllByLabelText",
7-
"queryByLabelText",
8-
"findAllByPlaceholderText",
9-
"findByPlaceholderText",
10-
"getAllByPlaceholderText",
11-
"getByPlaceholderText",
12-
"queryAllByPlaceholderText",
13-
"queryByPlaceholderText",
14-
"findAllByText",
15-
"findByText",
16-
"getAllByText",
17-
"getByText",
18-
"queryAllByText",
19-
"queryByText",
20-
"findAllByDisplayValue",
21-
"findByDisplayValue",
22-
"getAllByDisplayValue",
23-
"getByDisplayValue",
24-
"queryAllByDisplayValue",
25-
"queryByDisplayValue",
26-
"findAllByAltText",
27-
"findByAltText",
28-
"getAllByAltText",
29-
"getByAltText",
30-
"queryAllByAltText",
31-
"queryByAltText",
32-
"findAllByTitle",
33-
"findByTitle",
34-
"getAllByTitle",
35-
"getByTitle",
36-
"queryAllByTitle",
37-
"queryByTitle",
38-
"findAllByRole",
39-
"findByRole",
40-
"getAllByRole",
41-
"getByRole",
42-
"queryAllByRole",
43-
"queryByRole",
44-
"findAllByTestId",
45-
"findByTestId",
46-
"getAllByTestId",
47-
"getByTestId",
48-
"queryAllByTestId",
49-
"queryByTestId",
50-
];
2+
"findAllBy",
3+
"findBy",
4+
"getAllBy",
5+
"getBy",
6+
"queryAllBy",
7+
"queryBy",
8+
].flatMap((prefix) =>
9+
[
10+
"AltText",
11+
"DisplayValue",
12+
"LabelText",
13+
"PlaceholderText",
14+
"Role",
15+
"TestId",
16+
"Text",
17+
"Title",
18+
].map((element) => `${prefix}${element}`)
19+
);
5120

5221
(() => {
5322
try {

0 commit comments

Comments
 (0)