You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm very enthusiastic about replacing the ubiquitous backend JSON API with +page.server routes (mostly because of typing and that there's no need for fetch boilerplate) but I don't see anyway to test the returned data - which is normally an essential part of writing a backend API.
For example, I have a component
<script lang="ts">
import type { PageData } from "./$types"
import Folders from "./Folders.svelte"
export let data: PageData
</script>
<Folders folders={data.folders} />
In the above example, data, from +page.server.ts, is a very big and messy data structure and I'd like to get access to it for testing purposes (maybe only to snapshot it), but the only way I know of to access it in a test is after its already been rendered.
I can think of a few possible places to access it, but I'm not sure how or if its currently possible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm very enthusiastic about replacing the ubiquitous backend JSON API with +page.server routes (mostly because of typing and that there's no need for fetch boilerplate) but I don't see anyway to test the returned data - which is normally an essential part of writing a backend API.
For example, I have a component
In the above example, data, from +page.server.ts, is a very big and messy data structure and I'd like to get access to it for testing purposes (maybe only to snapshot it), but the only way I know of to access it in a test is after its already been rendered.
I can think of a few possible places to access it, but I'm not sure how or if its currently possible.
Beta Was this translation helpful? Give feedback.
All reactions