1.7 KiB
1.7 KiB
Summary
When querying the database using getByQuery
, it was interacting directly with the MongoCollection instead of going through mainDB. This meant there was no checking for the database existing or other error checking.
Details
findManyObjects
was added to mainDB.js as a way of querying the database for 1 or many results.
The promise was added to mainDB-promises.js
getByQuery
was then modified to use the new findManyObjects
function.
The getByQuery
test was updated to work correctly with the new method.
Unit tests were updated to test this new functionality.
The test for getByUUID
which used getByQuery
passed without any requirement for modification.
Test Plan:
- All unit tests run and pass
- Test results for daoFactory are:
daoFactory
✓ requires a collection name
✓ creates a factory
functions
createOne
✓ pass args correctly
✓ maps data correctly
getByQuery
calls getByQuery
✓ pass args correctly
getOneByQuery
success
✓ pass args correctly with ObjectId translation
✓ maps data correctly
fail
✓ returns null if not found
getOneByQueryAndDelete
success
✓ pass args correctly with ObjectId translation
✓ maps data correctly
fail
✓ returns null if not found
getOneByUUID
calls getOneByQuery
✓ pass args and adds _id to empty projection
✓ pass args and adds _id to projection
✓ maps data correctly
getByUUID
calls getByQuery
✓ pass args correctly
✓ maps data correctly
16 passing (21ms)