Files
OpenSquawk/tests/smoke/normalize.smoke.test.ts
itsrubberduck 3e560b3e23 Address classroom tester feedback (Detlef / FSC e.V.)
Fixes the most impactful issues from ~1.5h of testing:

- TTS: spell SID prefixes phonetically (ANEKI → Alfa November Echo Kilo
  India) so unfamiliar waypoint names are intelligible without prior
  briefing context.
- TTS: expand standalone uppercase waypoints after via/direct (with a
  skip list for common ATC English tokens like MAYDAY, CLEARED, …).
- TTS: join taxi route tokens with ", " so pauses land between
  taxiways (C5, Z5, U10, …) instead of running together.
- TTS: handle "ILS Z 25C" variant before the runway → "ILS Zulu runway
  two five center" (was previously read as "Zee twentyfive cee").
- Scenarios: derive arrivalRunway from the chosen approach so the
  controller no longer clears a flight for ILS 25C onto runway 18.
- Radio check: accept any readability 1–5 (numeric or spoken), shorten
  placeholder so it fits the sm-width field.
- Line-up readback: clearer hint about the runway-first ICAO order.
- Classroom UI: disable browser autocomplete/autocorrect on readback
  inputs (Edge autofill was injecting unrelated values).
- Classroom UI: "Speak answer" button replays the expected readback as
  TTS so students can hear the correct phrasing.

Tests adjusted for the new SID and taxi-route phonetics.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 10:24:48 +02:00

40 lines
1.3 KiB
TypeScript

import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { atcReplyPrompt, atcSeedPrompt, atcSystemPrompt, normalizeATC } from '~~/server/utils/normalize'
describe('normalize smoke', () => {
it('builds prompt templates with key context', () => {
const systemPrompt = atcSystemPrompt({ regionHint: 'EUR' })
const seedPrompt = atcSeedPrompt({
airport: 'EDDF',
aircraft: 'A320',
type: 'IFR',
stand: 'V155',
dep: 'EHAM',
runway: '25R',
phase: 'taxi',
})
const replyPrompt = atcReplyPrompt('DLH359 ready for departure RWY 25R', {
airport: 'EDDF',
runway: '25R',
phase: 'lineup',
lastFreq: '121.800',
})
assert.match(systemPrompt, /OUTPUT RULES \(STRICT\):/)
assert.match(seedPrompt, /Airport EDDF/)
assert.match(seedPrompt, /Phase: taxi/)
assert.match(replyPrompt, /Pilot said: "DLH359 ready for departure RWY 25R"/)
assert.match(replyPrompt, /Phase: lineup/)
})
it('normalizes ICAO phrase fragments for TTS pipeline', () => {
const normalized = normalizeATC('DLH359, taxi RWY 25R via N3 U4')
assert.match(normalized, /Lufthansa tree fife niner/)
assert.match(normalized, /runway too fife right/)
assert.match(normalized, /November tree,\s+Uniform four/)
})
})