Skip to content

Commit

Permalink
[@testing-library/react] Add v14 (#4439)
Browse files Browse the repository at this point in the history
* add v14

* apply new by role matcher breaking change

* fix new flow errors

* fix tests

* fix all new testing flow errors up to v11
  • Loading branch information
Brianzchen committed May 14, 2023
1 parent 250e0cb commit 9af16a6
Show file tree
Hide file tree
Showing 10 changed files with 3,845 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('act', () => {
});

it('should fail on incorrect usage of result', () => {
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[unsafe-addition]
act(() => {}) + 1;
// $FlowExpectedError[prop-missing]
act(() => {}).doesNotExist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ describe('act', () => {
act(() => {});
act(() => Promise.resolve());
act(() => ({
then: (resolve) => {},
then: (resolve: () => mixed) => {},
}));
});

it('should fail on incorrect usage of result', () => {
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[unsafe-addition]
act(() => {}) + 1;
// $FlowExpectedError[prop-missing]
act(() => {}).doesNotExist();
Expand Down Expand Up @@ -78,8 +78,8 @@ describe('waitForDomChange', () => {
});

it('should pass on correct inputs', () => {
waitForDomChange({ container: document.createElement('div') });
waitForDomChange({ timeout: 1 });
waitForDomChange<any>({ container: document.createElement('div') });
waitForDomChange<any>({ timeout: 1 });
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('act', () => {
});

it('should fail on incorrect usage of result', () => {
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[unsafe-addition]
act(() => {}) + 1;
// $FlowExpectedError[prop-missing]
act(() => {}).doesNotExist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ describe('act', () => {
act(() => {});
act(() => Promise.resolve());
act(() => ({
then: (resolve) => {},
then: (resolve: () => mixed) => {},
}));
});

it('should fail on incorrect usage of result', () => {
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[unsafe-addition]
act(() => {}) + 1;
// $FlowExpectedError[prop-missing]
act(() => {}).doesNotExist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('act', () => {
});

it('should fail on incorrect usage of result', () => {
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[unsafe-addition]
act(() => {}) + 1;
// $FlowExpectedError[prop-missing]
act(() => {}).doesNotExist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ describe('act', () => {
act(() => {});
act(() => Promise.resolve());
act(() => ({
then: (resolve) => {},
then: (resolve: () => mixed) => {},
}));
});

it('should fail on incorrect usage of result', () => {
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[unsafe-addition]
act(() => {}) + 1;
// $FlowExpectedError[prop-missing]
act(() => {}).doesNotExist();
Expand Down

0 comments on commit 9af16a6

Please sign in to comment.