← ClaudeAtlas

hasura-testslisted

Use when a Hasura GraphQL Engine needs tests, especially role-based row permissions: a docker-compose test instance, metadata API setup, x-hasura-role and x-hasura-user-id headers, and a role by table by operation permission matrix against the v1/graphql endpoint.
testland/qa-skills · ★ 0 · Testing & QA · score 72
Install: claude install-skill testland/qa-skills
# hasura-tests ## Overview Per [hasura.io/docs/2.0/auth/authorization/quickstart/](https://hasura.io/docs/2.0/auth/authorization/quickstart/), Hasura permissions are configured per **table**, **role**, and **operation** (select / insert / update / delete), with row- filter expressions and column-level scopes. The testable concerns are different from Apollo / Yoga: - **Permission rules are declarative**; tests verify the rule produces the expected filter SQL. - **Roles + session variables drive everything**; tests inject `x-hasura-role` + custom claims and assert the response shape. - **Metadata is the source of truth**; tests apply a fixture metadata then run queries. ## When to use - Testing a Hasura-backed API where row-level isolation is the primary concern (composes with `cross-tenant-data-leak-tests` in the qa-multi-tenancy plugin). - Verifying a new role's permission rules. - PR review of `hasura/metadata/` changes. - Regression-testing role transitions (user becomes admin, etc.). ## How to use 1. Bring up the ephemeral test stack (`docker compose -f docker-compose.test.yml up -d`) with introspection disabled and the console off. 2. Apply the fixture metadata that declares the permission rules under test, via the `/v1/metadata` API or `hasura metadata apply`. 3. Seed per-test rows so no test depends on another test's data. 4. Send queries to `/v1/graphql` with the admin secret plus an `x-hasura-role` override (and `x-hasura-user-id` / custom c