Tests

How the Deva Core is tested, what each test suite proves, and the edge cases the suite found and fixed.

The Deva Core test suite has 7 suites and 69 tests. It uses Node’s built-in node:test runner with node:assert/strict, so it adds no dependencies.

How to run it

Run the tests on Node.js 24 or later:

npm test

The suites

Each suite builds on the one before it, from building a Deva through to shutting it down.

Suite Tests What it proves
Build
00-build.test.js
1 build() makes a Deva that reaches ready.
Init
01-init.test.js
5 init() resolves with the ready data, waits for onReady, and a failing step or onError reject stops the chain.
Feature Getters
02-getters.test.js
31 Each feature getter returns exactly its own _key data as a copy, carries the client and its concerns, and answers offline after stop().
Hash
03-hash.test.js
6 The md5, sha256 and sha512 tiers match node:crypto, every hashing site carries all three, the uid fingerprint holds, and one changed field breaks every tier.
License
04-license.test.js
6 A matching VLA activates the Deva with stamped hashes; a changed, missing or absent VLA answers its message and stays inactive.
Messaging
05-messaging.test.js
12 question() runs local /commands and #ask calls to child Devas, child errors reach the asker right away, and missing or silent targets answer not found or timeout.
Shutdown
06-shutdown.test.js
8 stop() stops child Devas first, runs the full chain in order to onShutdown, clears features, answers pending asks offline and leaves nothing on the event bus.

Edge cases found and fixed

The suite found 3 edge cases. Each looks small on its own, but in a system of thousands of Devas any one of them becomes a real problem. All of them are fixed and covered by the tests.

Child errors reach the asker

A failing or throwing child Deva method now rejects the asker right away instead of waiting for the ask timeout. Fixed in version 1.64.7, tested in 05-messaging.test.js.

Pending asks at shutdown

A question still waiting on an answer when the Deva stops now resolves offline instead of hanging. Fixed in version 1.64.8, tested in 06-shutdown.test.js.

Parent stop reaches its children

A parent’s stop() now stops each child Deva through its full chain before the parent closes. Fixed in version 1.64.9, tested in 06-shutdown.test.js.