-
Notifications
You must be signed in to change notification settings - Fork 22
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
refactor(26237): Refactor the request infrastructure to the OpenAPI specs #566
base: epic/23777/bi-directional-frontend
Are you sure you want to change the base?
refactor(26237): Refactor the request infrastructure to the OpenAPI specs #566
Conversation
6a4233f
to
27b5978
Compare
a20eb7f
to
00135a9
Compare
fa1dd1b
to
17ec687
Compare
…roperly handle mocks
- update mocks - update tests
…E being in the specs
- rename GET hook
- remove old hooks - update mocks
…QTT dev Client - relocate the provider - export the sampling routine to handlers
00135a9
to
4f049d1
Compare
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.
LGTM! 🐊 Just found some small nits. Generally a really nice yet big PR :D
export const deviceHandlers = [ | ||
http.get('*/protocol-adapters/adapters/:adapterId/tags', ({ params }) => { | ||
const { adapterId } = params | ||
console.log('>', { adapterId }) |
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.
watch out a console that you might not want
it('should load the data', async () => { | ||
const { result } = renderHook(() => usePrivateMqttClient(), { wrapper }) | ||
|
||
expect(result.current).toStrictEqual<PrivateMqttClientType>({ state: undefined, actions: undefined }) |
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.
question: is it right that the data is empty? Does not match the title of the test
<ConditionalWrapper | ||
condition={import.meta.env.VITE_FLAG_MOCK_SERVER === 'true'} | ||
wrapper={(children) => <PrivateMqttClientProvider>{children}</PrivateMqttClientProvider>} |
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.
Neat!
@@ -23,6 +24,8 @@ vi.mock('@chakra-ui/react', async () => { | |||
return { ...actual, useTheme: vi.fn<[], Partial<WithCSSVar<Dict>>>(() => MOCK_THEME) } | |||
}) | |||
|
|||
//// 44-48,53-63,67-81,86-93 |
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.
question: what does that mean? seems like a debug comment to me
Some unit tests seem to fail due to not matching objects, I've added my approval so you can move forward after they are turned green. |
Sorry miss clicked on the wrong button. |
See https://hivemq.kanbanize.com/ctrl_board/57/cards/26237/details/
This PR is part of the bi-directional epic and refactors the query infrastructure to abide to the OpenAPI specs proposed in #563
Design
The current implementation of the bi-directional features in the frontend is still based on a series of mocks (both data and process) to bypass the work-in-progress nature of the backend.
To drive the alignment of the two parts of the engineering process, a proposal was made for the expected API endpoints.
The PR refactors the bespoke mocks into a proper micro-service API mocking
React Query
hooksMSW
to intercept the requests and populate the returned bodydev
-only and integrated with the relevantMSW
handlersNote that
MSW
needs to be activated for the mocks to be introduced. Change the following environment variable in theenv.local
files: