apollo
apollo copied to clipboard
normalQuery test not passing
Version
Reproduction link
https://codesandbox.io/s/nervous-murdock-jjtmq?file=/src/index.js
Steps to reproduce
- Use the provided server as the endpoint.
- Install the packages.
- Run the test script.
What is expected ?
The tests should pass.
What is actually happening?
The normalQuery test fails.
expect(received).toContain(expected) // indexOf
Expected substring: "cjw1jhoxi1f4g0112ayaq3pyz"
Received string: "<!doctype html>
<html data-n-head-ssr>
<head >
<title>Normal Query</title><style data-vue-ssr-id=\"3191d5ad:0\">.nuxt-progress{position:fixed;top:0;left:0;right:0;height:2px;width:0;opacity:1;-webkit-transition:width .1s,opacity .4s;transition:width .1s,opacity .4s;background-color:#000;z-index:999999}.nuxt-progress.nuxt-progress-notransition{-webkit-transition:none;transition:none}.nuxt-progress-failed{background-color:red}</style>
</head>
<body >
<div data-server-rendered=\"true\" id=\"__nuxt\"><!----><div id=\"__layout\"><div><ul><li><a href=\"/\" class=\"nuxt-link-active\">Index</a></li> <li><a href=\"/page-a\">Page A - only logged in user</a></li> <li><a href=\"/page-b\">Page B</a></li></ul> <div><div></div><div></div></div></div></div></div><script>window.__NUXT__={layout:\"default\",data:[{}],error:null,serverRendered:true,apollo:{defaultClient:{}}};</script><script src=\"/_nuxt/01600d5cf8307d1ab639.js\" defer></script><script src=\"/_nuxt/9d11ee4e407907c05ac6.js\" defer></script><script src=\"/_nuxt/b9bb5b781e3c2a6d7fe1.js\" defer></script><script src=\"/_nuxt/285f2c1bb56f8b0be417.js\" defer></script><script src=\"/_nuxt/9a34682f8a0f01ce86f3.js\" defer></script>
</body>
</html>
"
27 | test('normalQuery', async () => {
28 | const html = await get('/normalQuery')
> 29 | expect(html).toContain('cjw1jhoxi1f4g0112ayaq3pyz')
| ^
30 | })
31 |
32 | test('asyncData', async () => {
at Object.toContain (test/module.test.js:29:18)```
<!--cmty--><!--cmty_prevent_hook-->
<div align="right"><sub><em>This bug report is available on <a href="https://cmty.app/nuxt">Nuxt</a> community (<a href="https://cmty.app/nuxt/apollo-module/issues/c337">#c337</a>)</em></sub></div>
Pretty sure this is the same as the SSR not working issue