-
Notifications
You must be signed in to change notification settings - Fork 362
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
feat: add DataSource.deleteAllModels() API #1759
Conversation
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.
LGTM in terms of code and the reasons behind it. I suggest waiting for an approval from @raymondfeng before landing.
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.
Do we also want to update types/datasource.d.ts
file as well for this API?
Good catch! Of course we want to update typings too. |
fde6d6a
to
1f8f100
Compare
Amended the commit to include changes in |
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.
Nice 👍
When writing tests, for performance reasons we often want to reuse the same data-source instance for many tests suites. At the same time, we want to keep such test suites independent and allow them to reuse the same model name for different model classes. Juggler does support redefinition of a model with the same name. This change is adding a new API called that allows tests to remove all old models before creating new ones. This API would be typically called from a `before` hook. Signed-off-by: Miroslav Bajtoš <[email protected]>
1f8f100
to
78c5b12
Compare
@raymondfeng LGTY now? |
When writing tests, for performance reasons we often want to reuse the same data-source instance for many tests suites. At the same time, we want to keep such test suites independent and allow them to reuse the same model name for different model classes.
Juggler does support redefinition of a model with the same name.
This change is adding a new API called
dataSource.reset()
that allows tests to remove all old models before creating new ones (typically from abefore
hook).Related issues
This is very loosely related to loopbackio/loopback-next#3387.
Checklist
guide