MCPcopy
hub / github.com/alan2207/bulletproof-react / storeDb

Function storeDb

apps/nextjs-app/src/testing/mocks/db.ts:70–79  ·  view source on GitHub ↗
(data: string)

Source from the content-addressed store, hash-verified

68};
69
70export const storeDb = async (data: string) => {
71 // If we are running in a Node.js environment
72 if (typeof window === 'undefined') {
73 const { writeFile } = await import('fs/promises');
74 await writeFile(dbFilePath, data);
75 } else {
76 // If we are running in a browser environment
77 window.localStorage.setItem('msw-db', data);
78 }
79};
80
81export const persistDb = async (model: Model) => {
82 if (process.env.NODE_ENV === 'test') return;

Callers 1

persistDbFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected