-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves #498
- Loading branch information
Showing
10 changed files
with
114 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`ssr > cache fetches data correctly on SSR 1`] = `"<div data-server-rendered="true">data: value, status: server loaded</div>"`; | ||
exports[`ssr > cache fetches data correctly on SSR 1`] = `"<div>data: value, status: server loaded</div>"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
/** @vitest-environment node */ | ||
import Vue, { h, ref } from 'vue' | ||
import { createRenderer } from 'vue-server-renderer' | ||
import { createApp, h, ref } from 'vue' | ||
import { renderToString } from 'vue/server-renderer' | ||
|
||
import { describe, expect, it } from 'vitest' | ||
|
||
import { useCache } from '../src/cache' | ||
import { fetcher } from './helpers/utils' | ||
|
||
Vue.config.productionTip = false | ||
Vue.config.devtools = false | ||
|
||
describe('ssr', () => { | ||
it('cache fetches data correctly on SSR', async () => { | ||
const app = new Vue({ | ||
const app = createApp({ | ||
setup() { | ||
const { data, status } = useCache(ref('key'), () => fetcher('value')) | ||
|
||
return () => | ||
h('div', {}, [`data: ${data.value}, status: ${status.value}`]) | ||
}, | ||
}) | ||
const html = await createRenderer().renderToString(app) | ||
const html = await renderToString(app) | ||
expect(html).toMatchSnapshot() | ||
}) | ||
}, 10000) |