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

[Task] Add unit test cases for useSubmitInputInternal hook #136

Open
tjtanjin opened this issue Oct 6, 2024 · 7 comments · May be fixed by #253
Open

[Task] Add unit test cases for useSubmitInputInternal hook #136

tjtanjin opened this issue Oct 6, 2024 · 7 comments · May be fixed by #253
Assignees
Labels

Comments

@tjtanjin
Copy link
Owner

tjtanjin commented Oct 6, 2024

Task Description:
Currently, we run unit tests using jest which can be found here.

However, the test cases are not yet comprehensive enough and work can be done to cover more grounds. Specifically for this issue, we hope to add test cases for the useSubmitInputInternal hook.

Deliverable(s):
New unit test cases that cover the testing of the useSubmitInputInternal hook.

Additional Context:

  • Hooks API can be found here
  • Existing unit test for hooks can be found here which may serve as a good source for reference.
@anjumnnit
Copy link
Contributor

Task Description: Currently, we run unit tests using jest which can be found here.

However, the test cases are not yet comprehensive enough and work can be done to cover more grounds. Specifically for this issue, we hope to add test cases for the useSubmitInputInternal hook.

Deliverable(s): New unit test cases that cover the testing of the useSubmitInputInternal hook.

Additional Context:

  • Hooks API can be found here
  • Existing unit test for hooks can be found here which may serve as a good source for reference.

I can try this. Please assign.

@tjtanjin
Copy link
Owner Author

Task Description: Currently, we run unit tests using jest which can be found here.

However, the test cases are not yet comprehensive enough and work can be done to cover more grounds. Specifically for this issue, we hope to add test cases for the useSubmitInputInternal hook.

Deliverable(s): New unit test cases that cover the testing of the useSubmitInputInternal hook.

Additional Context:

  • Hooks API can be found here
  • Existing unit test for hooks can be found here which may serve as a good source for reference.

I can try this. Please assign.

Go for it!

@anjumnnit anjumnnit removed their assignment Oct 24, 2024
@anjumnnit
Copy link
Contributor

I worked on it but still facing some issue. you can assign it to someone else thankyou.

@mashazyu
Copy link
Contributor

@tjtanjin, hello,

I'd like to work on this one, if that's ok!

@tjtanjin
Copy link
Owner Author

@tjtanjin, hello,

I'd like to work on this one, if that's ok!

Go for it!

@mashazyu
Copy link
Contributor

@tjtanjin

I pushed some initial tests for the hook. While I was working on the tests I realized I have a question that I want to clarify before I move any further - how far should I go with the tests? I see that this hook uses values and triggers a lot of other contexts and hooks. So should I write tests for all/some of those calls as well?

Below is the list of those

import { usePathsInternal } from "./usePathsInternal";
import { useMessagesInternal } from "./useMessagesInternal";
import { useRcbEventInternal } from "./useRcbEventInternal";
import { useVoiceInternal } from "./useVoiceInternal";
import { useTextAreaInternal } from "./useTextAreaInternal";
import { useChatWindowInternal } from "./useChatWindowInternal";
import { useToastsInternal } from "./useToastsInternal";
import { useBotStatesContext } from "../../context/BotStatesContext";
import { useBotRefsContext } from "../../context/BotRefsContext";
import { useSettingsContext } from "../../context/SettingsContext";

@tjtanjin
Copy link
Owner Author

@tjtanjin

I pushed some initial tests for the hook. While I was working on the tests I realized I have a question that I want to clarify before I move any further - how far should I go with the tests? I see that this hook uses values and triggers a lot of other contexts and hooks. So should I write tests for all/some of those calls as well?

Below is the list of those

import { usePathsInternal } from "./usePathsInternal";
import { useMessagesInternal } from "./useMessagesInternal";
import { useRcbEventInternal } from "./useRcbEventInternal";
import { useVoiceInternal } from "./useVoiceInternal";
import { useTextAreaInternal } from "./useTextAreaInternal";
import { useChatWindowInternal } from "./useChatWindowInternal";
import { useToastsInternal } from "./useToastsInternal";
import { useBotStatesContext } from "../../context/BotStatesContext";
import { useBotRefsContext } from "../../context/BotRefsContext";
import { useSettingsContext } from "../../context/SettingsContext";

Hey @mashazyu! The tests should be scoped to just the logic within the hook itself. For other contexts and hooks that it relies on, those should be mocked (testing for these other parts are done within their own test cases).

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

Successfully merging a pull request may close this issue.

3 participants