Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

se0kcess
Copy link
Collaborator

@se0kcess se0kcess commented Dec 4, 2024

🗒️ Describe your changes

msw를 사용하여 api 테스트를 하기 위한 기본 환경 세팅

✅ PR CheckList

PR에 어떤 작업사항들이 반영됐는지 확인해주세요

  • msw 환경 세팅

📸 ScreenShots

image

🤔 To Reviewers

"public"
]
}
}
Copy link

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 */
Copy link

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 */

/**
Copy link

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'
Copy link

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 () {
Copy link

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({
Copy link

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',
Copy link

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"]
Copy link

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/**/*"]
Copy link

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/**/*"]
}
Copy link

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.

@se0kcess se0kcess closed this Dec 4, 2024
@se0kcess
Copy link
Collaborator Author

se0kcess commented Dec 4, 2024

사용안할듯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant