Files
selfphoneng/apps/api/test/asterisk-version.test.ts
T
iamdoubz a0121d4975 test: Asterisk upgrade check
verified.ts records what the code relies on Asterisk doing and the version it
was measured on; pnpm test fails while the Dockerfile pins another one.
pnpm test:asterisk-upgrade boots the image next to a TLS provider and lists
every behaviour that moved and what depends on it.
2026-10-28 17:01:26 -05:00

27 lines
1.1 KiB
TypeScript

// SPDX-License-Identifier: AGPL-3.0-or-later
// A new Asterisk in asterisk/Dockerfile must go through the upgrade check first (verified.ts).
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
import { VERIFIED_ASTERISK, pinnedAsterisk } from './asterisk/verified.ts';
describe('the pinned Asterisk', () => {
it('is the version the upgrade check last passed on', () => {
expect(
pinnedAsterisk(),
`asterisk/Dockerfile pins ${pinnedAsterisk()}, the upgrade check last passed on ` +
`${VERIFIED_ASTERISK}. Build the image, run \`pnpm test:asterisk-upgrade\` and ` +
'`pnpm test:asterisk`, act on what moved, then set VERIFIED_ASTERISK in ' +
'apps/api/test/asterisk/verified.ts',
).toBe(VERIFIED_ASTERISK);
});
it('is the one spec 01 §2 names', () => {
const spec = readFileSync(
new URL('../../../docs/spec/01-infrastructure.md', import.meta.url),
'utf8',
);
expect(spec).toContain(`**Pinned: \`${pinnedAsterisk()}\``);
expect(spec).toContain(`ARG ASTERISK_VERSION=${pinnedAsterisk()}`);
});
});