Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Add database unit tests #1484

Closed
12 tasks done
vitaly-t opened this issue Feb 2, 2018 · 3 comments
Closed
12 tasks done

Add database unit tests #1484

vitaly-t opened this issue Feb 2, 2018 · 3 comments

Comments

@vitaly-t
Copy link
Contributor

vitaly-t commented Feb 2, 2018

Changes within the database layer during the last month invalidate the existing approach to testing database-related functionality.

The updated database platform allows carrying out tests in complete isolation for each of the database repositories that's now available.

A new folder and structure is required within the /test/db, to contain files like blocks.js, accounts.js, etc, i.e. exactly matching the set of files of the corresponding database repository to be tested, as they can be found in folder /db/repos.

Once all the tests related to the use of database repositories are done like this, we can start simplifying core tests, to focus only on the business logic of the application.


Unit tests

@chiptus
Copy link
Contributor

chiptus commented Feb 5, 2018

can I have a take on this?

@vitaly-t
Copy link
Contributor Author

vitaly-t commented Feb 5, 2018

@chiptus It is already a work-in-progress: https://github.com/LiskHQ/lisk/tree/1484-database-tests/test/unit/db.

And I'm planning to get back to it this evening.

@nazarhussain
Copy link
Contributor

@vitaly-t @karmacoma I updated the issue description and removed these tasks from list.

  • Create a new /test/db folder + file structure, replicating that of the database repositories
  • Implement a generic stub interface for each repository to be tested in compete isolation
  • Create one sample, showing the use of the repository stub for testing

As the first point is covered. And for rest we decided to not mock DB I/O interface.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants