Files
NODEDC_DEVICE_CORE/services/device-control-core/test/device-edge-channel-migration.test.mjs
T

23 lines
871 B
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
const migrationUrl = new URL(
"../migrations/013_device_edge_channels.sql",
import.meta.url,
);
test("Edge channel migration extends the canonical Edge without storing keys", async () => {
const sql = await readFile(migrationUrl, "utf8");
assert.match(sql, /alter table device_edges/);
assert.match(sql, /channel_endpoint text/);
assert.match(sql, /channel_generation_ref text/);
assert.match(sql, /channel_trust_bundle_ref text/);
assert.match(sql, /channel_certificate_identities jsonb/);
assert.match(sql, /channel_lifecycle_state in \('disabled', 'active', 'revoked'\)/);
assert.match(sql, /where channel_lifecycle_state = 'active'/);
assert.doesNotMatch(sql, /private[_ ]?key/i);
assert.doesNotMatch(sql, /password/i);
});