fine tune msw handlers

This commit is contained in:
Gauthier Roebroeck 2025-10-21 14:53:55 +08:00
parent 58a489ac28
commit ad077c54d0
7 changed files with 12 additions and 9 deletions

View file

@ -45,7 +45,7 @@ export const Created: Story = {
export const Loading: Story = {
parameters: {
msw: {
handlers: [http.all('*', async () => await delay(5_000))],
handlers: [http.all('*/api/*', async () => await delay(5_000))],
},
},
play: async ({ userEvent }) => {

View file

@ -41,7 +41,7 @@ export const Loading: Story = {
},
parameters: {
msw: {
handlers: [http.all('*', async () => await delay(2_000))],
handlers: [http.all('*/api/*', async () => await delay(2_000))],
},
},
}

View file

@ -87,7 +87,7 @@ export const Loading: Story = {
},
parameters: {
msw: {
handlers: [http.all('*', async () => await delay(2_000))],
handlers: [http.all('*/v1/readlists', async () => await delay(2_000))],
},
},
}

View file

@ -59,7 +59,10 @@ export const Invalid: Story = {
export const Loading: Story = {
parameters: {
msw: {
handlers: [...meta.parameters.msw.handlers, http.post('*', async () => await delay(5_000))],
handlers: [
...meta.parameters.msw.handlers,
http.post('*/api/*', async () => await delay(5_000)),
],
},
},
play: async ({ canvas, userEvent }) => {
@ -85,7 +88,7 @@ export const Loading: Story = {
export const Error: Story = {
parameters: {
msw: {
handlers: [...meta.parameters.msw.handlers, http.post('*', response502BadGateway)],
handlers: [...meta.parameters.msw.handlers, http.post('*/api/*', response502BadGateway)],
},
},
play: async ({ canvas, userEvent }) => {

View file

@ -29,7 +29,7 @@ export const Default: Story = {
export const Loading: Story = {
parameters: {
msw: {
handlers: [http.all('*', async () => await delay(2_000))],
handlers: [http.all('*/api/*', async () => await delay(2_000))],
},
},
}

View file

@ -32,7 +32,7 @@ export const Default: Story = {
export const Loading: Story = {
parameters: {
msw: {
handlers: [http.all('*', async () => await delay(2_000))],
handlers: [http.all('*/api/*', async () => await delay(2_000))],
},
},
}

View file

@ -55,7 +55,7 @@ export const Invalid: Story = {
export const Loading: Story = {
parameters: {
msw: {
handlers: [http.all('*', async () => await delay(5_000))],
handlers: [http.all('*/api/*', async () => await delay(5_000))],
},
},
play: async ({ canvas, userEvent }) => {
@ -76,7 +76,7 @@ export const Loading: Story = {
export const Error: Story = {
parameters: {
msw: {
handlers: [http.post('*', response502BadGateway)],
handlers: [http.post('*/api/*', response502BadGateway)],
},
},
play: async ({ canvas, userEvent }) => {