doctrine / couchdb-odm

A Document Mapper based on CouchDB
http://www.doctrine-project.org
MIT License
150 stars 53 forks source link

Added command to compact all couchDB views #126

Open Tischi86 opened 7 years ago

Tischi86 commented 7 years ago

Added a command to compact all couchDB views

Ocramius commented 7 years ago

Requires test cases

hco commented 7 years ago

Hey @ocramius,

could you maybe help to get this merged by suggesting a sane way to test this? We discussed this internally, and could not really decide on a way to test this that brings a real benefit at an acceptable cost. :)

Greetings from Witten!

mikeSimonson commented 7 years ago

@hco, here you created a command that just use the library appropriately. So your test should make sure that when the command is used, the appropriate calls are passed to it with the corresponding options.

You can do that by mocking the library and assert the calls and options passed to the mock. The issue here is that you need to mock the getHelper() method and all the objects that you use to get the mongoDb client before you can test what is passed to it but it's doable.

hco commented 7 years ago

In my opinion a test that mocks away nearly all calls does not really have any benefit.

An integration test that would actually talk to CouchDB would make sense - is there any infrastructure for this?