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

Add store testing documentation #59

Merged
merged 2 commits into from
Mar 9, 2015

Conversation

jdlehman
Copy link
Collaborator

@jdlehman jdlehman commented Mar 9, 2015

Solves Issue #45. Sets up folder in docs for testing documentation.

@troutowicz
Copy link
Contributor

👍

}

static getInventory() {
return this.pets;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.getState().pets

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch!

@jdlehman
Copy link
Collaborator Author

jdlehman commented Mar 9, 2015

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).
Copy link
Owner

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.

goatslacker added a commit that referenced this pull request Mar 9, 2015
Add store testing documentation
@goatslacker goatslacker merged commit 5464b30 into goatslacker:master Mar 9, 2015
@goatslacker
Copy link
Owner

👍

@jdlehman jdlehman deleted the testing-stores branch March 12, 2015 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants