Skip to content

Commit 56e6602

Browse files
author
Sana Malik
committed
Fix error test
1 parent 2215ad5 commit 56e6602

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/@react-spectrum/labeledvalue/test/LabeledValue.test.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,18 @@ describe('LabeledValue', function () {
292292
});
293293

294294
it('throws when an editable value is provided', async function () {
295-
await waitFor(() => {
296-
expect(() => render(
295+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
296+
try {
297+
render(
297298
<LabeledValue
298-
data-testid="test-id"
299299
label="Field label"
300300
value={<input />} />
301-
)).toThrowError('LabeledValue cannot contain an editable value.');
302-
});
301+
);
302+
} catch (e) {
303+
console.log(e.message);
304+
expect(e.message).toEqual("LabeledValue cannot contain an editable value.");
305+
expect(consoleErrorSpy).toHaveBeenCalled();
306+
}
303307
});
304308

305309
it('attaches a user provided ref to the outer div', function () {

0 commit comments

Comments
 (0)