diff --git a/src/__tests__/suggestions.js b/src/__tests__/suggestions.js index 08ce2f7c..6c723a65 100644 --- a/src/__tests__/suggestions.js +++ b/src/__tests__/suggestions.js @@ -7,7 +7,7 @@ beforeAll(() => { }) afterEach(() => { - configure({testIdAttribute: 'data-testid'}) + configure({testIdAttribute: 'data-testid', throwSuggestions: true}) console.warn.mockClear() }) @@ -103,6 +103,17 @@ test('should not suggest when suggest is turned off for a query', () => { ).not.toThrowError() }) +test('should suggest when suggest is turned on for a specific query but disabled in config', () => { + configure({throwSuggestions: false}) + renderIntoDocument(` + + `) + + expect(() => screen.getByTestId('foo', {suggest: true})).toThrowError( + "try this:\ngetByRole('button', { name: /submit/i })", + ) +}) + test('should suggest getByRole when used with getBy', () => { renderIntoDocument(``)