Skip to content

Commit 399a184

Browse files
authored
Merge branch 'main' into test/suggestion-speed
2 parents 7bf4be2 + 3f64545 commit 399a184

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/__tests__/suggestions.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ beforeEach(() => {
1414

1515
afterEach(() => {
1616
jest.useRealTimers()
17-
configure({testIdAttribute: 'data-testid'})
17+
configure({testIdAttribute: 'data-testid', throwSuggestions: true})
1818
console.warn.mockClear()
1919
})
2020

@@ -110,6 +110,17 @@ test('should not suggest when suggest is turned off for a query', () => {
110110
).not.toThrowError()
111111
})
112112

113+
test('should suggest when suggest is turned on for a specific query but disabled in config', () => {
114+
configure({throwSuggestions: false})
115+
renderIntoDocument(`
116+
<button data-testid="foo">submit</button>
117+
<button data-testid="foot">another</button>`)
118+
119+
expect(() => screen.getByTestId('foo', {suggest: true})).toThrowError(
120+
"try this:\ngetByRole('button', { name: /submit/i })",
121+
)
122+
})
123+
113124
test('should suggest getByRole when used with getBy', () => {
114125
renderIntoDocument(`<button data-testid="foo">submit</button>`)
115126

0 commit comments

Comments
 (0)