|  | 
| 1 | 1 | import { getGlobalObject } from '@sentry/utils'; | 
| 2 | 2 | import { JSDOM } from 'jsdom'; | 
|  | 3 | +import { NEXT_DATA as NextData } from 'next/dist/next-server/lib/utils'; | 
| 3 | 4 | import { default as Router } from 'next/router'; | 
| 4 | 5 | 
 | 
| 5 | 6 | import { nextRouterInstrumentation } from '../../src/performance/client'; | 
| @@ -40,23 +41,23 @@ describe('client', () => { | 
| 40 | 41 |       props: any; | 
| 41 | 42 |       hasNextData: boolean; | 
| 42 | 43 |     }) { | 
|  | 44 | +      const nextDataContent: NextData = { | 
|  | 45 | +        props: pageProperties.props, | 
|  | 46 | +        page: pageProperties.route, | 
|  | 47 | +        query: pageProperties.query, | 
|  | 48 | +        buildId: 'y76hvndNJBAithejdVGLW', | 
|  | 49 | +        isFallback: false, | 
|  | 50 | +        gssp: true, | 
|  | 51 | +        appGip: true, | 
|  | 52 | +        scriptLoader: [], | 
|  | 53 | +      }; | 
|  | 54 | + | 
| 43 | 55 |       const dom = new JSDOM( | 
| 44 | 56 |         // Just some example what a __NEXT_DATA__ tag might look like | 
| 45 | 57 |         pageProperties.hasNextData | 
| 46 |  | -          ? `<body> | 
| 47 |  | -          <script id="__NEXT_DATA__" type="application/json"> | 
| 48 |  | -          { | 
| 49 |  | -            "props": ${JSON.stringify(pageProperties.props)}, | 
| 50 |  | -            "page": "${pageProperties.route}", | 
| 51 |  | -            "query": ${JSON.stringify(pageProperties.query)}, | 
| 52 |  | -            "buildId": "y76hvndNJBAithejdVGLW", | 
| 53 |  | -            "isFallback": false, | 
| 54 |  | -            "gssp": true, | 
| 55 |  | -            "appGip": true, | 
| 56 |  | -            "scriptLoader": [] | 
| 57 |  | -          } | 
| 58 |  | -          </script> | 
| 59 |  | -        </body>` | 
|  | 58 | +          ? `<body><script id="__NEXT_DATA__" type="application/json">${JSON.stringify( | 
|  | 59 | +              nextDataContent, | 
|  | 60 | +            )}</script></body>` | 
| 60 | 61 |           : '<body><h1>No next data :(</h1></body>', | 
| 61 | 62 |         { url: pageProperties.url }, | 
| 62 | 63 |       ); | 
|  | 
0 commit comments