Testing is based on the Jest testing framework. For convenient test writing, mockDatabase() and mockServer() are provided for database and server application testing.
Test environment variables are configured in the .env.test file. It's recommended to use an independent test database for testing.
mockDatabase()Provides a completely isolated db test environment by default
mockServer()Provides a mock server application instance, with corresponding app.db as a mockDatabase() instance. It also provides convenient app.agent() for testing HTTP APIs. For Tachybase Resource Actions, app.agent().resource() is also encapsulated for testing resource Actions.
If you need to test different process scenarios, you can execute related commands according to the following examples.
Terminal command line
Pre-test process
Terminal command line
Pre-test process
Terminal command line
Pre-test process
Terminal command line
Pre-test process
Terminal command line
Pre-test process
Pre-test process
Terminal command line
Pre-test process
Terminal command line
Pre-test process