Skip to content

Commit 56dd0e4

Browse files
committed
format
1 parent e4fbcb7 commit 56dd0e4

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

src/__tests__/element-queries.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test('query can return null', () => {
2929
})
3030

3131
describe('get throws a useful error message', () => {
32-
let missingRenderResult;
32+
let missingRenderResult
3333

3434
beforeEach(() => {
3535
missingRenderResult = render(
@@ -114,7 +114,8 @@ describe('get throws a useful error message', () => {
114114
test('Missing element', () => {
115115
const {getByText} = missingRenderResult
116116

117-
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
117+
expect(() => getByText('LucyRicardo'))
118+
.toThrowErrorMatchingInlineSnapshot(`
118119
Unable to find an element with the text: LucyRicardo. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
119120
120121
Ignored nodes: comments, script, style
@@ -133,7 +134,8 @@ describe('get throws a useful error message', () => {
133134
</div>
134135
`)
135136

136-
expect(() => getByText(' LucyRicardo ', {})).toThrowErrorMatchingInlineSnapshot(`
137+
expect(() => getByText(' LucyRicardo ', {}))
138+
.toThrowErrorMatchingInlineSnapshot(`
137139
Unable to find an element with the text: LucyRicardo (normalized from ' LucyRicardo '). This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
138140
139141
Ignored nodes: comments, script, style
@@ -142,7 +144,8 @@ describe('get throws a useful error message', () => {
142144
</div>
143145
`)
144146

145-
expect(() => getByText(/LucyRicardo/)).toThrowErrorMatchingInlineSnapshot(`
147+
expect(() => getByText(/LucyRicardo/))
148+
.toThrowErrorMatchingInlineSnapshot(`
146149
Unable to find an element that its text match the regex: /LucyRicardo/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
147150
148151
Ignored nodes: comments, script, style
@@ -173,14 +176,15 @@ describe('get throws a useful error message', () => {
173176
<div />
174177
</div>
175178
`)
176-
});
179+
})
177180

178181
test('Multiple elements', () => {
179182
const {getByText} = render(
180183
`<div><span>LucyRicardo</span><span>LucyRicardo</span></div><!-- Ignored comment --><style type="text/css">body {} </style><script type="text/javascript></script>`,
181-
);
184+
)
182185

183-
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`Found multiple elements with the text: LucyRicardo
186+
expect(() => getByText('LucyRicardo'))
187+
.toThrowErrorMatchingInlineSnapshot(`Found multiple elements with the text: LucyRicardo
184188
185189
Here are the matching elements:
186190
@@ -206,7 +210,7 @@ Ignored nodes: comments, script, style
206210
LucyRicardo
207211
</span>
208212
</div>
209-
</div>`);
213+
</div>`)
210214

211215
expect(() => getByText('LucyRicardo', {selector: 'span'}))
212216
.toThrowErrorMatchingInlineSnapshot(`Found multiple elements with the text: LucyRicardo, which matches selector 'span'
@@ -236,8 +240,8 @@ Ignored nodes: comments, script, style
236240
</span>
237241
</div>
238242
</div>`)
239-
});
240-
});
243+
})
244+
})
241245

242246
test('ByTestId', () => {
243247
const {getByTestId} = missingRenderResult
@@ -322,7 +326,8 @@ Ignored nodes: comments, script, style
322326
</div>
323327
`)
324328

325-
expect(() => getByTitle(' LucyRicardo ')).toThrowErrorMatchingInlineSnapshot(`
329+
expect(() => getByTitle(' LucyRicardo '))
330+
.toThrowErrorMatchingInlineSnapshot(`
326331
Unable to find an element with the title: LucyRicardo (normalized from ' LucyRicardo ').
327332
328333
Ignored nodes: comments, script, style

src/queries/display-value.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ const getMissingError: GetErrorFunction<[Matcher, MatcherOptions]> = (
5555
options = {},
5656
) => `Unable to find an element ${getMatcherHintOrDefault(value, options)}.`
5757

58-
function getMatcherHintOrDefault(
59-
matcher: Matcher,
60-
options: MatcherOptions,
61-
) {
58+
function getMatcherHintOrDefault(matcher: Matcher, options: MatcherOptions) {
6259
const matcherHint = getMatcherHint(matcher, 'that its display value')
6360

6461
if (matcherHint) {

src/queries/placeholder-text.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ const getMissingError: GetErrorFunction<[Matcher, MatcherOptions]> = (
2424
options = {},
2525
) => `Unable to find an element ${getMatcherHintOrDefault(text, options)}`
2626

27-
function getMatcherHintOrDefault(
28-
matcher: Matcher,
29-
options: MatcherOptions,
30-
) {
27+
function getMatcherHintOrDefault(matcher: Matcher, options: MatcherOptions) {
3128
const matcherHint = getMatcherHint(matcher, 'that its placeholder text')
3229

3330
if (matcherHint) {

src/queries/title.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ const getMissingError: GetErrorFunction<[Matcher, MatcherOptions]> = (
4848
options = {},
4949
) => `Unable to find an element ${getMatcherHintOrDefault(title, options)}.`
5050

51-
function getMatcherHintOrDefault(
52-
matcher: Matcher,
53-
options: MatcherOptions,
54-
) {
51+
function getMatcherHintOrDefault(matcher: Matcher, options: MatcherOptions) {
5552
const matcherHint = getMatcherHint(matcher, 'that its title')
5653

5754
if (matcherHint) {

0 commit comments

Comments
 (0)