---
id: TST-COM-ORD-063
title: 'The entitlements tables (integration, table)'
kind: integration
product_area: commerce
module: orders
revision: 1
status: draft
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
repository: services-commerce
files:
  - modules/entitlements/tests/integration/db/entitlements-tables.table.integration.spec.js
implements: []
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 2
isolation: The suite creates its own test workspace records and removes them using the fixture cleanup.
evidence:
  - provenance: test
    source: >-
      services-commerce:modules/entitlements/tests/integration/db/entitlements-tables.table.integration.spec.js
    test_cases:
      - 'holds the rows, the note trimmed by the trigger and the remaining quantity generated (premise)'
      - refuses a holder kind outside contact and organization
      - refuses a kind the register does not hold
      - 'refuses a state outside active, revoked and expired'
      - 'refuses a zero grant, a use count past the grant and a negative use count'
      - refuses a window that ends before it starts
      - 'refuses a revoked grant with no revocation instant, and an expired one with no expiry instant'
      - refuses a line with no order
      - 'refuses a second grant of the same kind on one line, and admits another kind'
      - 'refuses a grant of a line, an order or an obligation the tenant does not have'
      - >-
        refuses a use of index zero, a use with a consumer outside the application-id grammar, a restored use
        with no reason, a second use at one index, and a use of an unknown grant
      - 'shows a tenant its own grants and uses alone, and the owner both tenants’'
      - refuses a grant written into another tenant
      - >-
        answers the caller’s tenant alone: the active grants with uses left, the unlimited among them, by
        holder, kind and product
      - 'leaves out a grant with nothing left, and a revoked one'
      - >-
        is executable by rhythm_commerce_consumer, a NOLOGIN, NOBYPASSRLS role the application role is a
        member of, and by nobody else
      - >-
        refuses a malformed call with SQLSTATE RHC06: a quantity of zero, a holder of another kind, a
        reference with no consumer
scenario_coverage: []
dependency_evidence:
  provenance: test
  source: 'services-commerce:modules/entitlements/tests/integration/db/entitlements-tables.table.integration.spec.js'
  declared_by_test: 'PostgreSQL built from the migrations, both roles, the execution context''s transaction. Doubled: nothing.'
---

# The entitlements tables (integration, table)

## Verification Boundary

The suite exercises persistence or workflow operations against the local integration database.

## What This Suite Proves

The registered cases check the entitlements tables (integration, table) with their fixture records and assertions. Scenario bindings name only the examples those cases exercise.

## What It Does Not Prove

A registered file supplies no run result or verified conformance by itself. Local fixtures do not establish deployed cross-service behavior or complete browser journeys.

## Real Dependencies and Test Doubles

PostgreSQL and the exercised Commerce persistence or workflow code are real. Remote service records, clocks and transports follow the suite’s fixtures.

## Must Not Be Doubled

The database constraints, role restrictions, locks and transactions exercised by this suite must use PostgreSQL.
