JCC Express

Database Testing

Database testing in JCC Express MVC is done through assertion helpers exposed by TestCase (powered by InteractsWithDatabase).


Available assertions

From your test instance:

  • assertDatabaseHas(table, data)
  • assertDatabaseMissing(table, data)
  • assertDatabaseCount(table, count)
  • assertModelExists(model)
  • assertModelMissing(model)

Example usage

TypeScript

How model assertions work

  • assertModelExists(model) checks model table + primary key value
  • assertModelMissing(model) checks that matching primary key is not present

These are useful after create/delete/restore operations.


Notes

  • assertions use DB.table(...) queries under the hood
  • make sure your test database is configured correctly before running tests
  • if tests share state, isolate with reliable setup/cleanup patterns in hooks