-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I've just ran into an issue where the mock data was silently skipped, which caused confusion on my end.
Maybe we could have an env var that we set during testing to prevent the mock worker from forwarding unmatched requests to the real worker
self.onmessage = async function (event: MessageEvent<MutationOverTimeQuery>) {
await workerFunction(async () => {
const query = mockQueries.find((mockQuery) => JSON.stringify(mockQuery.query) === JSON.stringify(event.data));
if (query !== undefined) {
return query.response;
}
// add something like:
// if (env.MOCK_ONLY) throw new Error(...)
return await getMutationOverTimeWorkerFunction(event);
});
};I think we need to have it with an env var, because we sometimes still want to have the mock worker fall back, because the story book is also used for user demos. Otherwise we wouldn't need to switch.
Metadata
Metadata
Assignees
Labels
No labels