UNPKG

@atomazing-org/mock-plop

Version:

The `@atomazing-org/mock-plop` library is a configuration script designed for Plop, a tool aimed at automating code generation within projects utilizing templates. Specifically, this script focuses on generating and updating files associated with mocks (p

21 lines (13 loc) 526 B
import { http, delay, HttpResponse } from 'msw' import { root } from '@constants/paths' import { mockData } from './mockData' const mock{{ name }}Post = http.post(`${root}{{ url }}`, async () => { const body = {} await delay(1000) return HttpResponse.json(body, { status: 200 }) }) const mock{{ name }}Get = http.get(`${root}{{ url }}`, async () => { await delay(1000) return HttpResponse.json(mockData, { status: 200 }) }) export const mock{{ name }} = [mock{{ name }}Post, mock{{ name }}Get]