@@ -620,17 +620,26 @@ describe('ReactDOMServer', () => {
620620 describe ( 'renderToStaticNodeStream' , ( ) => {
621621 it ( 'should generate simple markup' , ( ) => {
622622 const SuccessfulElement = React . createElement ( ( ) => < img /> ) ;
623- const response = ReactDOMServer . renderToStaticNodeStream (
624- SuccessfulElement ,
625- ) ;
626- expect ( response . read ( ) . toString ( ) ) . toMatch ( new RegExp ( '<img' + '/>' ) ) ;
623+ expect ( ( ) => {
624+ const response =
625+ ReactDOMServer . renderToStaticNodeStream ( SuccessfulElement ) ;
626+ expect ( response . read ( ) . toString ( ) ) . toMatch ( new RegExp ( '<img' + '/>' ) ) ;
627+ } ) . toErrorDev ( 'ReactDOMServer.renderToStaticNodeStream() is deprecated' , {
628+ withoutStack : true ,
629+ } ) ;
627630 } ) ;
628631
629632 it ( 'should handle errors correctly' , ( ) => {
630633 const FailingElement = React . createElement ( ( ) => {
631634 throw new Error ( 'An Error' ) ;
632635 } ) ;
633- const response = ReactDOMServer . renderToStaticNodeStream ( FailingElement ) ;
636+
637+ let response ;
638+ expect ( ( ) => {
639+ response = ReactDOMServer . renderToStaticNodeStream ( FailingElement ) ;
640+ } ) . toErrorDev ( 'ReactDOMServer.renderToStaticNodeStream() is deprecated' , {
641+ withoutStack : true ,
642+ } ) ;
634643 return new Promise ( resolve => {
635644 response . once ( 'error' , ( ) => {
636645 resolve ( ) ;
@@ -689,9 +698,7 @@ describe('ReactDOMServer', () => {
689698 }
690699
691700 ReactDOMServer . renderToString ( < Foo /> ) ;
692- expect ( ( ) =>
693- jest . runOnlyPendingTimers ( ) ,
694- ) . toErrorDev (
701+ expect ( ( ) => jest . runOnlyPendingTimers ( ) ) . toErrorDev (
695702 'Warning: setState(...): Can only update a mounting component.' +
696703 ' This usually means you called setState() outside componentWillMount() on the server.' +
697704 ' This is a no-op.\n\nPlease check the code for the Foo component.' ,
@@ -719,9 +726,7 @@ describe('ReactDOMServer', () => {
719726 }
720727
721728 ReactDOMServer . renderToString ( < Baz /> ) ;
722- expect ( ( ) =>
723- jest . runOnlyPendingTimers ( ) ,
724- ) . toErrorDev (
729+ expect ( ( ) => jest . runOnlyPendingTimers ( ) ) . toErrorDev (
725730 'Warning: forceUpdate(...): Can only update a mounting component. ' +
726731 'This usually means you called forceUpdate() outside componentWillMount() on the server. ' +
727732 'This is a no-op.\n\nPlease check the code for the Baz component.' ,
0 commit comments