Files
tcp-ingestion/test/device-authority.test.ts
julian 1e9219d14a Implement Phase 1 tasks 1.1-1.4 (scaffold + core shell + Teltonika framing)
- Project scaffold (Node 22 + TS 5 + pnpm + vitest + ESLint flat config)
- Core shell: TCP server, session loop, adapter registry, types
- Configuration (zod-validated env) and pino logger
- Teltonika adapter: IMEI handshake, frame envelope, CRC-16/IBM,
  codec dispatch registry, DeviceAuthority seam (AllowAllAuthority default)

Codec data parsers (1.5-1.7), Redis publisher (1.8), and downstream
tasks remain. 36 tests covering CRC, framing, handshake, device
authority, config, and core server. typecheck/lint/test/build all clean.
2026-04-30 15:51:07 +02:00

20 lines
725 B
TypeScript

import { describe, it, expect } from 'vitest';
import { AllowAllAuthority } from '../src/adapters/teltonika/device-authority.js';
describe('AllowAllAuthority', () => {
it('returns "known" for any IMEI', async () => {
const authority = new AllowAllAuthority();
expect(await authority.check('356307042441013')).toBe('known');
});
it('returns "known" for an empty string (authority ignores content)', async () => {
const authority = new AllowAllAuthority();
expect(await authority.check('')).toBe('known');
});
it('returns "known" for an unknown/unseen IMEI', async () => {
const authority = new AllowAllAuthority();
expect(await authority.check('999999999999999')).toBe('known');
});
});