-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: msw ์ค์น ๋ฐ ์ ์ฉ * style: alias ์ ์ฉ * chore: msw-storybook-addon ์ ์ฉ * chore: storybook ์ค์ ์ถ๊ฐ * chore: jest msw ์ค์ ์ถ๊ฐ
- Loading branch information
Showing
11 changed files
with
1,562 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { SetupWorkerApi, setupWorker } from 'msw'; | ||
|
||
import mockApis from '.'; | ||
|
||
export const worker: SetupWorkerApi = setupWorker(...mockApis); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { RequestHandler } from 'msw'; | ||
|
||
import * as sample from './sample'; | ||
|
||
const mockApis = Object.values({ | ||
sample, | ||
}).flatMap((apis: Record<string, RequestHandler>) => Object.values(apis)); | ||
|
||
export default mockApis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//TODO: api ์์ฑ ํ ์ญ์ | ||
import { rest } from 'msw'; | ||
|
||
export const mockApiSample = rest.post('/test', (req, res, ctx) => res(ctx.json(1))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { SetupServerApi, setupServer } from 'msw/node'; | ||
|
||
import mockApis from '.'; | ||
|
||
export const server: SetupServerApi = setupServer(...mockApis); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
// Optional: configure or set up a testing framework before each test. | ||
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js` | ||
// Used for __tests__/testing-library.js | ||
// Learn more: https://github.com/testing-library/jest-dom | ||
import '@testing-library/jest-dom/extend-expect'; | ||
|
||
import { server } from './__mocks__/apis/server'; | ||
|
||
/* eslint-disable */ | ||
|
||
beforeAll(() => server.listen()); | ||
afterEach(() => { | ||
server.resetHandlers(); | ||
}); | ||
afterAll(() => server.close()); |
Oops, something went wrong.