-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add store testing documentation #59
Conversation
👍 |
} | ||
|
||
static getInventory() { | ||
return this.pets; |
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.
this.getState().pets
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.
Ah, good catch!
Rebased with test fixes, and everything is passing now. |
|
||
One thing we can do is to test our class before it is wrapped by alt, the unwrapped class. We should trust the alt library to test its own internals, so we can just test the inaccessible methods in our plain class by exporting it separately from our alt wrapped store (via `alt.createStore`). To do this, we can export it as a separate file, or use a named export for our unwrapped class and the default export for our alt wrapped class (in the example below, I will use the latter for simplicity). | ||
|
||
Another method to get at the unwrapped class is to do something like `AltWrappedStore[Object.getOwnPropertySymbols(AltWrappedStore)[2]]` as detailed [here](https://gist.github.com/troutowicz/d9dcb7e7e9e77032f602). |
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.
We should remove this, while it's clever it's not recommended since the symbol may change indices in the future.
Add store testing documentation
👍 |
Solves Issue #45. Sets up folder in docs for testing documentation.