-
Notifications
You must be signed in to change notification settings - Fork 0
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
[OUR415-314] Improves our test story with test templates and helpers for search; adds BrowserRefinementList
component test
#259
Conversation
BrowserRefinementList
component test
BrowserRefinementList
component testBrowserRefinementList
component test
import { createSearchClient } from "../../../../test/helpers/createSearchClient"; | ||
|
||
describe("BrowseRefinementList", () => { | ||
test("renders the correct the number of categories", async () => { |
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 (non-blocking): There are 12 categories in searchClient but expected is 10. Is there anything in the repo that explains this?
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.
Good question. I updated the test name to indicate more explicitly what this is testing.
@@ -39,10 +39,12 @@ const BrowseRefinementList = ({ attribute, transform }: Props) => { | |||
setChecked(checked); | |||
}; | |||
|
|||
// console.log(items); |
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.
chore: Let's get rid of this
*/ | ||
export function createSearchClient(options: Options) { | ||
return { | ||
search: (requests: any) => |
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 (if-minor): In the interest of minimizing lint warnings, can we change these 2 'any' types in this file or can we lint ignore this file?
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.
Oops yeah, forgot to add ignore statements. I was going to clean up all the warnings in a separate PR so I can do it there.
@@ -0,0 +1,25 @@ | |||
/** | |||
* Template for a simple component test |
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.
praise: Good idea
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 answer / address my comments but looks good to me otherwise!
import { createSearchClient } from "../../../../test/helpers/createSearchClient"; | ||
|
||
describe("BrowseRefinementList", () => { | ||
test("renders the correct the number of categories", async () => { |
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.
nitpick (non-blocking): Could you remove the second "the"?
I wrote our first component test of a component with Algolia hooks. This code establishes a precedent but as more tests are written we might come up with improvements to the "test harness" to increase ease of writing tests.