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

For testing purposes and recommendations #86

Closed
theo-bittencourt opened this issue Jan 6, 2020 · 3 comments
Closed

For testing purposes and recommendations #86

theo-bittencourt opened this issue Jan 6, 2020 · 3 comments
Labels
question Further information is requested

Comments

@theo-bittencourt
Copy link

Hey. Thank you for this great project!

My main intention with this lib is to load fixtures for automated testing on a Nest project.
But after reading the following statement in the README, it has brought me doubts about the purpose of this library:

Although typeorm-fixtures-cli is intended to use as a CLI, you can still load fixtures via APIs in your program.

Loading the fixtures using the CLI means the data will be loaded once for the entire testing suite.
One general practice for automated testing is to isolate testing data between testing cases.
I'm trying to figure out why programmatically loading is not faced as the first option here. 🙃

@RobinCK
Copy link
Owner

RobinCK commented Mar 11, 2020

You can use this code:
https://github.com/RobinCK/typeorm-fixtures#programmatically-loading-fixtures
after each test clear database and repeat load dataset

@RobinCK RobinCK added the question Further information is requested label Mar 11, 2020
@theo-bittencourt
Copy link
Author

Yep! I'm using that already.

But I'm not sure whether that will continue to work fine for complex relationships. It's been harder to set up the e2e tests as the project grows up because we need to look up for multiple files to track the correct relationships.

Coming from Rails, I'm missing something like FactoryBot to build these data for tests.

I can't figure out yet how Node devs are setting up that data.

@moulinraphael
Copy link

Hey I'm missing the same. The way Rails is handling data during tests with FactoryBot is so useful.

Is it possible not to load all the fixtures but only specific ones (and then all recursive references) ?

@RobinCK RobinCK closed this as completed Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants