Skip to main contentA-REX Foundation

Conception du système · AREX-TEST

Testing

Use Node.js 20 or 22 LTS with npm; the committed package lock.json is the source of truth for dependency versions. Newer Node majors may print Hardhat support warnings.

Identifiant du document
AREX-TEST
Version
2.0
Date
2026-09-21
Disponible uniquement en anglais
Cette page est en anglais. Les chapitres du livre blanc et les diagrammes sont traduits. Le standard normatif reste dans le dépôt ; utilisez Demander un accès anticipé pour ce texte. Les guides de conception du système et les enregistrements de décision restent en anglais.
FieldValue
Document IDAREX-TEST
Version2.0
Date2026-09-21
RelatedAREX-SDD-001 §12 (traceability matrix), AREX-AUD-001 §7 (coverage matrix)

Test layers

LayerLocationCovers
Standard / referencetest/standard/ARexToken.test.jsbatches, lineage, ERC-7943 enforcement, hook pipeline, conformance, upgrade authorization
Standard / hookstest/standard/DomainHooks.test.jsperishability, seasonal, delivery, traceability, sanctions TTL
Standard / extensionstest/standard/Extensions.test.jsprice oracle, carbon wrapper, parametric insurance
Documentation / guidetest/standard/ImplementationGuide.test.jsevery code block of the Implementation Guide and the example hooks in contracts/examples/, executed in order
Standard / invariantstest/standard/Invariants.test.jsseeded random operation sequences; supply conservation, terminal status, canTransfer ⇔ outcome, lock

Commands

Use Node.js 20 or 22 LTS with npm; the committed package-lock.json is the source of truth for dependency versions. Newer Node majors may print Hardhat support warnings.

Determinism rules

  • Tests that advance chain time restore a snapshot in after() so they do not leak into other files (takeSnapshot / restore).
  • No test depends on wall-clock time: CommodityPriceOracle numbers its rounds instead of bucketing block.timestamp, and the seasonal tests set the block time explicitly.
  • The invariant test is seeded (AREX_INVARIANT_SEED); a failure is reproducible with the same seed and step count.

What tests establish

Repeatable evidence of implemented behaviour in the Hardhat environment. They do not establish absence of vulnerabilities, regulatory compliance, correctness of off-chain data, economic safety, production gas viability across chains, or storage compatibility of future upgrades beyond the OpenZeppelin plugin validation.

Before production

  • Third-party audit (package: AUDIT-READINESS.md).
  • Fork tests on every target chain.
  • Worst-case batch gas benchmarks with the production hook set.
  • Upgrade rehearsal against a mainnet fork with the plugin's validateUpgrade.