Testing Examples (Root + Access User)
February 28, 2026 ยท View on GitHub
This folder provides a full example for SurrealKit's surrealkit test runner that covers:
- Tables and field type checks (
string,number,datetime) - Computed field assertions
- Function assertions
- Graph/edge assertions (
RELATEwith relation table) - Root user vs record access-user permissions
- Record access account provisioning through
SIGNUP, followed by authentication throughSIGNIN - API endpoint examples for both root and access user
Files
config.toml: global test config withrootandaccess_useractorsfixtures/root_and_access_setup.surql: schema/access/function/api setupsuites/root_access_full_stack.toml: end-to-end suite
Reports
Copy these into your active test directories:
cp /examples/testing/config.toml /database/tests/config.toml
cp /examples/testing/suites/root_access_full_stack.toml /database/tests/suites/root_access_full_stack.toml
cp /examples/testing/fixtures/root_and_access_setup.surql /database/tests/fixtures/root_and_access_setup.surql
Then run:
surrealkit test --suite '*root_access_full_stack*' --json-out database/tests/report.json
Notes
- The suite uses a
recordaccess actor (kind = "record") withaccess = "app_access". access_useris created by the runner withsignup_params, then authenticated withsignin_params, so the test setup exercises the access method instead of relying on a pre-created fixture account.- JSON assertions can compare a returned field to the authenticated actor with
equals_auth = "$auth.id"or another$auth.<property>reference. - API paths (
/api/v1/health,/api/v1/profile) are placeholders. Update them to match your API routes. - The runner uses ephemeral namespace/database isolation by default.