ci / verify (push) Canceled after 0s
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
18 lines
1.2 KiB
JavaScript
18 lines
1.2 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { volumeSyncMessage } from '../src/components/device-volume-state.ts';
|
|
import { memorySection } from '../src/pages/memory-section.ts';
|
|
const twin = (revision, actual) => ({ desired_revision: 19, reported_revision: revision, desired_config: { volume: { speaker: 56 } }, reported_config: { volume: { speaker: actual } } });
|
|
test('volume confirms only the matching actual value and revision', () => {
|
|
assert.match(volumeSyncMessage(twin(19, 56), true), /已生效/);
|
|
assert.match(volumeSyncMessage(twin(18, 56), true), /等待设备确认/);
|
|
assert.match(volumeSyncMessage(twin(19, 55), true), /等待设备确认/);
|
|
assert.match(volumeSyncMessage(twin(18, 55), false), /上线后/);
|
|
assert.match(volumeSyncMessage(undefined), /读取/);
|
|
assert.match(volumeSyncMessage({ ...twin(19, 0), desired_config: { volume: { speaker: 0 } } }), /已生效/);
|
|
});
|
|
test('daily and long-term memory categories cover all supported types', () => {
|
|
for (const type of ['EVENT', 'OPEN_ITEM', 'INTERACTION']) assert.equal(memorySection(type), 'daily');
|
|
for (const type of ['PROFILE', 'PREFERENCE', 'RELATIONSHIP', 'STORY']) assert.equal(memorySection(type), 'memory');
|
|
});
|