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

init commit #18

Merged
merged 7 commits into from
May 3, 2020
Merged

init commit #18

merged 7 commits into from
May 3, 2020

Conversation

s3aryal
Copy link
Member

@s3aryal s3aryal commented Mar 5, 2020

No description provided.

@christikaes
Copy link
Member

Awesome! 🎉

I don't see any new cypress tests for this work here https://dashboard.cypress.io/projects/34dwxm/runs/6/specs. I'd like to make sure that we are testing the code as we are developing it to reduce possible future regressions. Let us know if you need any help with writing tests!

Copy link
Member

@binamkayastha binamkayastha left a comment

Choose a reason for hiding this comment

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

Looks good overall!
The next step is to update the response objects to follow the descriptions in the respective issues (which I linked to specific endpoints).

I did the delete one as an example :)
Also added a few nits (small change suggestions)

Let me know if you have any questions, great job so far 👍 👍 👍

server/server.js Outdated
res.sendStatus(200);
app.delete('/organization_id', function (req, res) {
var id = req.query.id;
let org = organizations[id]
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why do a let org here, did you mean to send it in the response?

server/server.js Outdated

app.listen(port, () => console.log(`Example app listening on port ${ port }!`))
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Missing enter at the end of the file

server/server.js Outdated
0: { 'Name': 'Nandu Business', 'Net Worth': '6 Billion', 'Business Type': 'Real Estate Dealer' },
1: { 'Name': 'Sailesh Business', 'Net Worth': '20 Billion', 'Business Type': 'Food Dealer' }
}
const event = {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: To follow the format of organizations being plural, event here should also be plural

server/server.js Outdated

app.get('/event_details', function(req, res){
var id = req.query.id;
let lit = event[id]
Copy link
Member

Choose a reason for hiding this comment

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

Nit: lit is probably not the best name 😂
If you rename event to events, then lit here can become event.

Suggested change
let lit = event[id]
let event = events[id]

server/server.js Outdated
var id = req.query.id;
let org = organizations[id]
delete organizations[id]
res.sendStatus(200)
Copy link
Member

Choose a reason for hiding this comment

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

Issue: #11
Here's what you'd need to change to make it compliant to the issue:

Suggested change
res.sendStatus(200)
if (org) {
res.status(200)
res.send({
"success": 1,
"timestamp": new Date().getTime()
})
} else {
res.status(500)
res.send({
"success": 0,
"timestamp": new Date().getTime()
"error": "Organization with id " + id + " does not exist!"
})
}

I just wrote this in a comment and haven't tested this out, so there might be some bugs here :P

server/server.js Outdated
app.post('/organization_id', function(req, res) {
var id = req.query.id;
organizations[id] = req.query;
res.sendStatus(200);
Copy link
Member

Choose a reason for hiding this comment

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

Issue: #9

server/server.js Outdated
}
organizations[id] = org;

res.sendStatus(200);
Copy link
Member

Choose a reason for hiding this comment

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

Issue: #10

server/server.js Outdated
app.get('/organizations_id', function (req, res) {
var id = req.query.id;
let org = organizations[id]
res.send(org)
Copy link
Member

Choose a reason for hiding this comment

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

Issue: #8

@cypress
Copy link

cypress bot commented Mar 24, 2020



Test summary

10 0 0 0


Run details

Project United Nepali
Status Passed
Commit fbdef97
Started May 3, 2020 7:57 PM
Ended May 3, 2020 7:58 PM
Duration 00:21 💡
OS Linux Ubuntu Linux - 16.04
Browser Electron 78

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@christikaes
Copy link
Member

Great job adding tests, let's merge this in now and we can continue iterating in the future

@christikaes christikaes merged commit dbc3626 into master May 3, 2020
@christikaes christikaes deleted the endpoints_branch branch May 3, 2020 20:02
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