-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] QFEED-102 msw 초기 설정 #53
Conversation
"public" | ||
] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline at the end of the file to follow the standard conventions.
@@ -0,0 +1,295 @@ | |||
/* eslint-disable */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the eslint and tslint disable lines if they are not necessary for this file.
/* eslint-disable */ | ||
/* tslint:disable */ | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding more detailed comments to describe the purpose and functionality of this service worker.
* - Please do NOT serve this file on production. | ||
*/ | ||
|
||
const PACKAGE_VERSION = '2.6.6' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider storing the PACKAGE_VERSION
and INTEGRITY_CHECKSUM
in a separate constants or configuration file for better maintainability.
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') | ||
const activeClientIds = new Set() | ||
|
||
self.addEventListener('install', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling in the event listeners to catch and handle any potential errors.
|
||
export const handlers = [ | ||
http.get('/api/users', () => { | ||
return HttpResponse.json({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HttpResponse.json is not a function in 'msw'. You should use res
function with ctx.json
to return JSON response.
export const handlers = [ | ||
http.get('/api/users', () => { | ||
return HttpResponse.json({ | ||
id: '1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user data returned here is hard-coded. If this is a mock for testing, consider moving this to a separate mock data file.
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
"noFallthroughCasesInSwitch": true, | ||
"types": ["vite/client", "node"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to see that you've added vite/client
and node
to the types
array. However, please ensure that these types are installed as dependencies in your package.json
file.
}, | ||
"include": ["src", "custom.d.ts", "svg.d.ts", "types"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
"include": ["src", "vite.config.ts", "src/mocks/**/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've removed custom.d.ts
, svg.d.ts
, and types
from the include
array. If these files or directories are still in use in your project, you should include them back to avoid any potential issues.
}, | ||
"include": ["src", "custom.d.ts", "svg.d.ts", "types"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
"include": ["src", "vite.config.ts", "src/mocks/**/*"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've removed the reference to tsconfig.node.json
. If this file is still in use in your project, you should include it back to avoid any potential issues.
사용안할듯 |
🗒️ Describe your changes
msw를 사용하여 api 테스트를 하기 위한 기본 환경 세팅
✅ PR CheckList
PR에 어떤 작업사항들이 반영됐는지 확인해주세요
📸 ScreenShots
🤔 To Reviewers