Skip to content

Commit 6dbf94f

Browse files
authored
docs: clarify how queryBy behaves (#251)
1 parent 0e40023 commit 6dbf94f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

docs/Queries.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,19 @@ title: Queries
1010
1111
### getBy
1212

13-
`getBy*` queries returns the first matching node for a query, and throws an
14-
error if no elements match.
13+
`getBy*` queries return the first matching node for a query, and throw an error if no elements match or if more than one match is found (use `getAllBy` instead).
1514

1615
### getAllBy
1716

18-
`getAllBy*` queries return an array of all matching nodes for a query, and
19-
throws an error if no elements match.
17+
`getAllBy*` queries return an array of all matching nodes for a query, and throw an error if no elements match.
2018

2119
### queryBy
2220

23-
`queryBy*` queries returns the first matching node for a query, and return
24-
`null` if no elements match. This is useful for asserting an element is not
25-
present.
21+
`queryBy*` queries return the first matching node for a query, and return `null` if no elements match. This is useful for asserting an element that is not present. This throws if more than one match is found (use `queryAllBy` instead).
2622

2723
### queryAllBy
2824

29-
`queryAllBy*` queries return an array of all matching nodes for a query, and
30-
return an empty array (`[]`) if no elements match.
25+
`queryAllBy*` queries return an array of all matching nodes for a query, and return an empty array (`[]`) if no elements match.
3126

3227
## Queries
3328

0 commit comments

Comments
 (0)