-
Notifications
You must be signed in to change notification settings - Fork 145
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
Collection of Ionic Mocks for Use in Every Project #21
Comments
I'm reluctant to put all my mocks into a single |
Thanks for your input, @kamok. It is good to hear how other people organize their unit testing efforts. I'm not against creating individual class files for each mock. To me, having them in one file makes it convenient for maintenance and versioning. |
Hello @leifwells , Take a look at ionic-test-doubles, having all this mocks in this template repository may not be useful for components developing. |
Hey guys just stumbled on this comment. I was having a very similar issue and ended up creating this project. https://github.com/stonelasley/ionic-mocks. |
@stonelasley - looks excellent. If you'd have time for a PR on clicker we can increase the userbase for ionic-mocks. |
@lathonez that sounds great. I'll do that for sure, clicker has been my go-to reference for many a project. |
Hi I am just starting to dive into the topic. The question that arise to me now is: What problems could bring only using a mocking library like https://github.com/NagRock/ts-mockito ? From my point of view, having a set of mocked classes pre built looks to me that keeping them in sync as the framework evolve can be cumbersome. Using the mocking library we will mock just what is needed. Am i missing something? |
EDIT: I just realized that the main place I've grabbed Ionic mock from was the Clicker project.
mocks.ts
. Thanks to @lathonez for making this file available.I created this issue to begin a discussion around mock objects in Ionic (and I'm not sure where else to have this discussion).
I've been doing a lot of unit testing lately for an Ionic 2 application. One of the things I've found to be very helpful is that there appear to be many mock objects available out there for use in Ionic unit testing. I've put together a few objects that I've needed in a current project into one file so that I can reference them. Take a look.
FYI:
Here's my issue. For this project, having reliable Ionic mocks is important. We should be unit testing our applications, not the Ionic Framework. There is no reason for each of us to be building their own set of Ionic mocks. As a community, we should be able to assemble these mocks.
Shouldn't we be able to provide mocks for as many of the Ionic pieces that may be needed?
Shouldn't we be able to provide best practices as to where to place these mocks and how to use them?
Re: Best practices: Currently, I have three files in my project:
src/testing/mock-ionic.ts
: Ionic mockssrc/testing/mock-app.ts
: mocks of object created in my projectsrc/testing/mock-data.ts
: mock data that I can use with my mock servicesThis is how I've organized my current project. Again, YMMV.
Let the discussion begin.
The text was updated successfully, but these errors were encountered: