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

Multiple mocks with same name #650

Open
GrumpyMeow opened this issue Nov 30, 2021 · 1 comment
Open

Multiple mocks with same name #650

GrumpyMeow opened this issue Nov 30, 2021 · 1 comment

Comments

@GrumpyMeow
Copy link
Contributor

Hi,

every now and then a developer adds a new mock by cloning an existing mock-file, but forgets to change the name of the mock. (Doh!) Ngapimock does not check for this situation.

I think that having mocks with the same name is invalid in every situation and should throw an error on this. This will increase the user-experience of novice ngapimock users.

thanks!

@mdasberg
Copy link
Contributor

mdasberg commented Dec 1, 2021

@GrumpyMeow Debug information is already logged to detect duplicates.

You can enable debug logging with the following command:

export DEBUG=ng-apimock:*

This will result in a log message:

ng-apimock:processor-mock Mock with identifier '<mock name>' already exists. Overwriting existing mock.

We could introduce a configuration flag to throw an error in case there are duplicate mocks? @GrumpyMeow what do you think?

This way we don't introduce a breaking change, but provide the option to throw in case you want to.

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

No branches or pull requests

2 participants