Closed paultranvan closed 8 years ago
Can you add some unit tests?
@nono, yep, @Ljinod is on it :)
Le 14/03/2016 13:47, Bruno Michel a écrit :
Can you add some unit tests?
— Reply to this email directly or view it on GitHub https://github.com/cozy/cozy-data-system/pull/214#issuecomment-196295468.
@Gara64 @nono Can we merge that one?
@frankrousseau nope, it's not ready
@Gara64 can you look at linting? Travis builds show some errors with it
@Ljinod do you need some help for the unit tests?
@nono I'm okay for now and I should have the tests for controllers/sharing
soon
@nono I fixed the linting and added @Ljinod's tests units. I still need to fix 3 tests that failed though.
@Gara64 Good news!
@nono Seems ok now :)
@frankrousseau do you want to review this PR too?
A few remarks :
unless rule.docType and rule.id
docInfo
instead of passing directly bodyToTransmit ? It will be 1 - less RAM-hungry (by at least 2 byte :neutral_face: ) 2 - future-proof if we want to have sharing by tags or other fun things later. The unit approach makes for great speed, but the http approach ensure everything works (for instance here, you dont test the correct ID is passed to db.delete, only that db.delete has been called).
Not sure which approach is best, may be we neeed both, but it's the reason you have to stub a lot of things with all the XXX Ugly parts (which could be replaced by https://github.com/howardabrams/node-mocks-http#usage)
Yep, I would like to review this one before merging.
@aenario About your three first remarks : I agree and I changed accordingly. I let @Ljinod answers for the unit tests.
I made some comments about code styles. After that I vote for a merge of this PR.
Implements sharing capabilities for the data-system, as described here.
The logic is split in 2 files :
Note this code can only work if the proxy and home are able to receive and interpret sharing requests. But this will come later :)