Skip to content

Commit 57dca4e

Browse files
committed
Fix tests
1 parent fd9fadd commit 57dca4e

File tree

1 file changed

+27
-36
lines changed

1 file changed

+27
-36
lines changed

packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js

+27-36
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
18671867
expect(ReactNoop.getChildren()).toEqual([span('Loading...')]);
18681868
});
18691869

1870-
it('warns when a low priority update suspends inside a high priority update for functional components', async () => {
1870+
// TODO: flip to "warns" when this is implemented again.
1871+
it('does not warn when a low priority update suspends inside a high priority update for functional components', async () => {
18711872
let _setShow;
18721873
function App() {
18731874
let [show, setShow] = React.useState(false);
@@ -1883,20 +1884,17 @@ describe('ReactSuspenseWithNoopRenderer', () => {
18831884
ReactNoop.render(<App />);
18841885
});
18851886

1886-
expect(() => {
1887-
ReactNoop.act(() => {
1888-
Scheduler.unstable_runWithPriority(
1889-
Scheduler.unstable_UserBlockingPriority,
1890-
() => _setShow(true),
1891-
);
1892-
});
1893-
}).toErrorDev(
1894-
'Warning: App triggered a user-blocking update that suspended.' + '\n\n',
1895-
{withoutStack: true},
1896-
);
1887+
// TODO: assert toErrorDev() when the warning is implemented again.
1888+
ReactNoop.act(() => {
1889+
Scheduler.unstable_runWithPriority(
1890+
Scheduler.unstable_UserBlockingPriority,
1891+
() => _setShow(true),
1892+
);
1893+
});
18971894
});
18981895

1899-
it('warns when a low priority update suspends inside a high priority update for class components', async () => {
1896+
// TODO: flip to "warns" when this is implemented again.
1897+
it('does not warn when a low priority update suspends inside a high priority update for class components', async () => {
19001898
let show;
19011899
class App extends React.Component {
19021900
state = {show: false};
@@ -1915,17 +1913,13 @@ describe('ReactSuspenseWithNoopRenderer', () => {
19151913
ReactNoop.render(<App />);
19161914
});
19171915

1918-
expect(() => {
1919-
ReactNoop.act(() => {
1920-
Scheduler.unstable_runWithPriority(
1921-
Scheduler.unstable_UserBlockingPriority,
1922-
() => show(),
1923-
);
1924-
});
1925-
}).toErrorDev(
1926-
'Warning: App triggered a user-blocking update that suspended.' + '\n\n',
1927-
{withoutStack: true},
1928-
);
1916+
// TODO: assert toErrorDev() when the warning is implemented again.
1917+
ReactNoop.act(() => {
1918+
Scheduler.unstable_runWithPriority(
1919+
Scheduler.unstable_UserBlockingPriority,
1920+
() => show(),
1921+
);
1922+
});
19291923
});
19301924

19311925
it('does not warn about wrong Suspense priority if no new fallbacks are shown', async () => {
@@ -1961,8 +1955,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
19611955
expect(Scheduler).toHaveYielded(['Suspend! [A]', 'Suspend! [B]']);
19621956
});
19631957

1958+
// TODO: flip to "warns" when this is implemented again.
19641959
it(
1965-
'warns when component that triggered user-blocking update is between Suspense boundary ' +
1960+
'does not warn when component that triggered user-blocking update is between Suspense boundary ' +
19661961
'and component that suspended',
19671962
async () => {
19681963
let _setShow;
@@ -1982,17 +1977,13 @@ describe('ReactSuspenseWithNoopRenderer', () => {
19821977
ReactNoop.render(<App />);
19831978
});
19841979

1985-
expect(() => {
1986-
ReactNoop.act(() => {
1987-
Scheduler.unstable_runWithPriority(
1988-
Scheduler.unstable_UserBlockingPriority,
1989-
() => _setShow(true),
1990-
);
1991-
});
1992-
}).toErrorDev(
1993-
'Warning: A triggered a user-blocking update that suspended.' + '\n\n',
1994-
{withoutStack: true},
1995-
);
1980+
// TODO: assert toErrorDev() when the warning is implemented again.
1981+
ReactNoop.act(() => {
1982+
Scheduler.unstable_runWithPriority(
1983+
Scheduler.unstable_UserBlockingPriority,
1984+
() => _setShow(true),
1985+
);
1986+
});
19961987
},
19971988
);
19981989

0 commit comments

Comments
 (0)