Describe the bug
Mocks in the unit test suite do not work when you use more than one method in the same test.
Example: If you want to test in a method the limit with orderByor wherewith offset, won't work.
Then the test will break showing about the query.orderBy is not a function
Expected behavior
I expect that multiple causes in the test runner cases work's fine together
Additional context
I believe that the problem is because how the methods works overriding the knex(mock) instance to join multiple conditions in the same query.
if (options.limit > 0) query = query.limit(options.limit)
if (options.offset > 0) query = query.offset(options.offset)
See the find method in the image:
When the query var, receives a new query instance, the order methods that was inside the knex instance, no longer exists
Describe the bug Mocks in the unit test suite do not work when you use more than one method in the same test. Example: If you want to test in a method the limit with
orderBy
orwhere
with offset, won't work.To Reproduce Steps to reproduce the behavior:
should return entities with column order by
method: https://github.com/herbsjs/herbs2knex/blob/c2ed15994c067d1a76a842942ea59e5e28737391/test/queries/find.js#L81the query.orderBy is not a function
Expected behavior I expect that multiple causes in the test runner cases work's fine together
Additional context I believe that the problem is because how the methods works overriding the knex(mock) instance to join multiple conditions in the same query.
See the find method in the image:
When the query var, receives a new query instance, the order methods that was inside the knex instance, no longer exists