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
Badge GET api #163
Badge GET api #163
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
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.
Great work!! @whyDontI 🎉 😄
Can we generate the API Schema for this route?
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.
Looks great!! 🎉
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.
Having a doubt in the test case 😅
describe('Badges', function () { | ||
describe('GET /badges', function () { | ||
it('Should get all the list of badges', function (done) { | ||
chai | ||
.request(app) | ||
.get('/badges') | ||
.end((err, res) => { | ||
if (err) { return done() } | ||
expect(res).to.have.status(200) | ||
expect(res.body).to.be.a('object') | ||
expect(res.body.message).to.equal('Badges returned successfully!') | ||
expect(res.body.badges).to.be.a('array') | ||
|
||
return done() | ||
}) | ||
}) | ||
}) | ||
}) |
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.
Where are we adding the badges in the database to GET
them? 🤔
How will this test case pass on CI? 🤔
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.
Ankush is going to add badges manually in database until we get the authorization in place.
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.
Ankush is going to add badges manually in database until we get the authorization in place.
I guess the CI also uses firebase emulators that's why we install it on every commit.
I meant the CI doesn't use the production db, right?
Feel free to correct me 😄
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.
Yes, seems like CI uses emulator, check test.yml file in .git/workflow
CI fetching and adding data in prod DB won't be a good idea
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.
That's what I'm saying 😅
The prod DB will have the badges details
but the firebase emulator wont and hence the test wouldn't pass 😅
Let me know if I'm wrong 😄
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.
Oh, that's the convention, even if the GET Endpoint returns an empty array, the response code will still be 200, and the request is considered fulfilled.
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.
Cool
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.
Looks good! 👌🏻
Added
API Contracts
Real-Dev-Squad/website-api-contracts#29