-
-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
f18be94
to
ec9f50e
Compare
Did some work on this today. Getting of one or more events needs tidying up but works. I've hacked up a create function, but am not feeling much love from MongoDb in regards to referencing the User collection in the Events collection. |
I've finally gotten some love from MongoDb, but much tidying up to do before I push those changes. Should be able to get this reviewable for a first cut this week, hopefully tomorrow. |
57c8791
to
e2cea7b
Compare
Finally started with writing tests 🙌 |
All CRUD methods apart from update have been implemented, all implemented methods apart from getEvents (plural) have tests in ▶ yarn test src/dataLayer/mongo/event-datalayer.test.js
yarn run v1.6.0
$ cross-env JWT_CERT=test jest --runInBand --verbose --silent src/dataLayer/mongo/event-datalayer.test.js
PASS src/dataLayer/mongo/event-datalayer.test.js
createCommunityEvent
✓ should return an Event object (13ms)
✓ should throw if an attendee does yet exist (4ms)
getCommunityEvent
✓ should return an Event object for a valid request (5ms)
✓ title search should throw when no matching events are found (1ms)
✓ externalId search should throw when no matching events are found (1ms)
✓ should throw if the externalId is not valid (2ms)
✓ should throw if the title is not valid (1ms)
deleteCommunityEvent
✓ should delete an existing event (12ms)
✓ should return with an error for a non existing event (3ms)
✓ should refuse deletion of events owned by other users (3ms)
Test Suites: 1 passed, 1 total
Tests: 10 passed, 10 total
Snapshots: 2 passed, 2 total
Time: 1.268s, estimated 2s
✨ Done in 3.56s. My next steps will be to:
I'll refrain from implementing the update function for now. My main goals were to have something that could do with Pagination (getEvents being one), dataloader and query depth limitation. A nice upshot is that we have a model and framework for events, when that will be implemented. My thoughts are to get this ready for review starting next week if time permits. I'd love to get it in by mid week so I can start working on Pagination, dataloader and query depth limitation. |
Current status:
|
Things that I'm aware of and could/should improve:
|
At the off chance someone was going to review this; I've got an integration test written up, but not yet committed. This included refactoring error handling, two birds one stone 😄 Running both integration and unit test will cause a collision in user creation, I'll tidy that up before I push things out. That will be either this evening or tomorrow. |
I'm raising issues for all boxes that I ticked but did not address yet:
|
I'm sure this could do with a lot of improvements, and I'm happy to revisit some of the work. For now I'm going to merge this so I can start work on related issues without a future merge nightmare. |
@ojongerius I just want to extend my thanks for taking this up! You are absolutely the rockstar man. |
@ojongerius There is something wrong with the test "should refuse deletion of events owned by other users". The assertions are not happening. Add expect.assertions(3) on top and you will see the test failing saying that it received zero assertion calls. |
Not ready for QA but this adds visibility and facilitates discussion about the implementation.
I'll keep pagination (#90), dataloaders (#38) and query depth limitation (#89) out of scope of this PR, but those things are exactly what I aim to work after Events go in. All of those things make sense when we have events in place, and will help mature the project.
src/dataLayer/mongo/communityEvent.js
should return errors for a query skipping a mandatory field: skipped mandatory field error 1