You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This feature mostly already exists in v0.4.4. This issue is for tracking progress for this feature in the TypeScript rewrite of this package.
Tests to confirm this feature should be:
Golden Path Tests
A NedbClient instance exists in the SuperCamo static client list, when connected.
A NedbClient instance can be retrieved using a SuperCamo static method, when connected.
A NedbClient instance retrieved from the SuperCamo static class has a valid database folder path.
A NedbClient instance retrieved from the SuperCamo static class has a valid database name.
A NedbClient instance should be able to perform database document Create operations. (Note: this section needs more tests!)
insertOne (returns object)
valid data leads to a successful document creation
passes along any errors from document creation as-is
insertMany (returns object array)
valid data leads to a successful document creation
passes along any errors from document creation as-is
createOne (returns document)
valid data leads to a successful document creation
passes along any errors from document creation as-is
createMany (returns document array)
valid data leads to a successful document creation
passes along any errors from document creation as-is
A NedbClient instance should be able to perform database document Read operations.
findOneDocument
empty query returns a random document in the specified database collection
query for top-level data keys in a document returns appropriately
query for nested-level data keys in a document returns appropriately
query for data keys that do not exist in the document returns nothing
throws an error if the collection to be queried does not exist in the database
findOneObject
empty query returns a random object in the specified database collection
query for top-level data keys in a object returns appropriately
query for nested-level data keys in a object returns appropriately
query for data keys that do not exist in the object returns nothing
query given an option with a projection object returns an object containing appropriate keys per the projection
throws an error if the collection to be queried does not exist in the database
findManyDocuments
empty query returns ALL documents in the database
query for top-level data keys in a document returns appropriately
query for nested-level data keys in a document returns appropriately
query for data keys that do not exist in the document returns an empty array
if a limit option is provided, the returned array of documents should be no larger than the specified limit
throws an error if the collection to be queried does not exist in the database
findManyObjects
empty query returns ALL documents in the database
query for top-level data keys in a document returns appropriately
query for nested-level data keys in a document returns appropriately
query for data keys that do not exist in the document returns an empty array
if a limit option is provided, the returned array of documents should be no larger than the specified limit
query given an option with a projection object returns an object containing appropriate keys per the projection
throws an error if the collection to be queried does not exist in the database
A NedbClient instance should be able to perform database document Update operations.
findAndUpdateOneDocument
returns null when given a query returns no documents
returns an appropriately-modified document when given a valid query for top-level document properties and valid new document data
returns an appropriately-modified document when given a valid query for nested-level document properties and valid new document data
upsert option causes a new record to be created in the database if no existing document matches the query, with a document returned
when the upsert option is used, no document matches, and invalid data is provided, then the function passes along any errors from document creation as-is
findAndUpdateManyDocuments
returns an empty array when given a query returns no documents
returns an array of appropriately-modified document when given a valid query for top-level document properties and valid new document data
returns an array of appropriately-modified document when given a valid query for nested-level document properties and valid new document data
if a limit option is provided, the returned array of modified documents should be no larger than the specified limit
if an upsert option is provided alongside valid data and a query with no matches, an array containing one new database entry is returned
invalid update data causes the function to throw an error
data that is invalid for some documents but not all will throw an error, but successfully apply to some documents
eg. unique property on a document should work for one document, but not two
findAndUpdateOneObject
returns null when given a query returns no documents
returns an appropriately-modified document object when given a valid query for top-level document properties and valid new document data
returns an appropriately-modified document object when given a valid query for nested-level document properties and valid new document data
upsert option causes a new record to be created in the database if no existing document matches the query, with an object returned
when the upsert option is used, no document matches, and invalid data is provided, then the function passes along any errors from document creation as-is
findAndUpdateManyObjects
returns an empty array when given a query returns no documents
returns an array of appropriately-modified document when given a valid query for top-level document properties and valid new document data
returns an array of appropriately-modified document when given a valid query for nested-level document properties and valid new document data
if a limit option is provided, the returned array of modified documents should be no larger than the specified limit
if an upsert option is provided alongside valid data and a query with no matches, an array containing one new database entry is returned
invalid update data causes the function to throw an error
data that is invalid for some documents but not all will throw an error, but successfully apply to some documents
eg. unique property on a document should work for one document, but not two
A NedbClient instance should be able to perform database document Delete operations.
findAndDeleteOne
returns 0 when given a query returns no documents
returns the number of documents deleted when given a valid query that matches a document
findAndDeleteMany
returns 0 when given a query returns no documents
returns the number of documents deleted when given a valid query that matches a document
A NedbClient instance method can count the occurrences of Documents that match a given query.
empty query counts all docs in collection
query for top-level properties works appropriately
query for nested-level properties works appropriately
The text was updated successfully, but these errors were encountered:
And this is a simplified task list. Gonna handle document and embedded document validation tests separately, as documents can exist separately from the NedbClient.
Otherwise there would've been many, many, many more tests to write in this feature.
This feature mostly already exists in v0.4.4. This issue is for tracking progress for this feature in the TypeScript rewrite of this package.
Tests to confirm this feature should be:
Golden Path Tests
The text was updated successfully, but these errors were encountered: