Skip to main contentA-REX Foundation

Системное проектирование · 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.

Идентификатор документа
AREX-TEST
Версия
2.0
Дата
2026-09-21
Источник
docs/TESTING.md
Доступно только на английском
Эта страница на английском. Главы whitepaper и диаграммы переведены. Нормативный стандарт остаётся в репозитории; для этого текста используйте Запросить ранний доступ. Руководства по системному проектированию и записи о решениях остаются на английском.
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.