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

fix: convert collectionType to appropiate format before param-validation #510

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

prabalsingh24
Copy link
Contributor

Problem

An error was occurring while creating Edition-Group collection.

Solution

In the paramValidation middleware, I forgot to take convert entityType to camel-case before validating it.

Areas of Impact

src/server/helpers/middleware.js
test/src/server/routes/collection.js

@coveralls
Copy link

coveralls commented Sep 8, 2020

Coverage Status

Coverage remained the same at 60.995% when pulling 8f22779 on prabalsingh24:fix-edition-group-bug into e233463 on bookbrainz:master.

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

Good fix.
I love that there's tests to go with it :)

expect(collection.get('id')).to.equal(res.body.id);
expect(collection.get('ownerId')).to.equal(collectionOwner.get('id'));
expect(collection.get('name')).to.equal(data.name);
expect(collection.get('entityType')).to.equal(_.upperFirst(_.camelCase(data.entityType)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's change the expectation specifically to what we expect it to be, 'EditionGroup'.
That way if anything changes and we don't receive 'EditionGroup' we'll know something is wrong.


expect(res.status).to.equal(200);
expect(updatedCollectionJSON.name).to.equal(newData.name);
expect(updatedCollectionJSON.entityType).to.equal(_.upperFirst(_.camelCase(newData.entityType)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

Great !

@MonkeyDo MonkeyDo merged commit 939b54f into metabrainz:master Sep 10, 2020
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.

3 participants