Unit Testing for components with IMessageService #4303
Unanswered
mdmontesinos
asked this question in
Q&A
Replies: 1 comment 3 replies
-
I've also tried rendering the MessageProvider component in the TestContext like this: IRenderedComponent<MessageProvider> messageProvider = ctx.RenderComponent<MessageProvider>(); And when I click the button that should open the modal, the content of the modal component does change (according to the title and message established). I'm also able to locate the Confirm/Cancel button by using the Find method in MessageProvider component. However, when clicking it, nothing triggers in the original component, so I'm still stuck waiting for the confirm. Any clues on how to proceed? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any way to test a component that requires IMessageService by using bUnit?
The main issue I have is that when I render my component, the markup for it only includes the component itself, not the html code for the modal. Therefore, I'm not able to find the confirm/cancel button to keep the flow of the component going.
I know the MessageProvider component should be included next to the App component, but how does that translate to unit testing?
Below I include the relevant code that I have so far.
Test Method:
Method to be executed after clicking the button:
Beta Was this translation helpful? Give feedback.
All reactions