Files
tiefenkontakt/packages/shared/tests/classes.test.ts
T
db9979 7b0a071e8e Add bridge lookouts, radar room, ops tooling, graphic mails and Pi deploy
- Escorts: bridge lookouts (periscope feather, snorkel, surfaced boats,
  torpedo tracks), spoken sighting reports, 3D bridge station with
  binoculars and own foredeck, lookout hit inset
- 3D sea split into models/shaders: multi-wave ocean with whitecaps,
  clouds, sun and moon, detailed ships with smoke and turning radar
- Radar room rebuilt as phosphor PPI with range scales, ESM rose and
  radar status; NATO symbols on plot, mission charts and replay
- Sortable and filterable contact list, leaderboard and alert log;
  smoothed list bearings; clear convoy progress bar
- Ops: backups, metrics, structured logs, CI, Elo ratings, private
  matches, corvette and coastal sub, network load test
- Mail: configurable SMTP (Gmail/iCloud), signal-style HTML mails with
  inline sonar header, mail test command
- Fixes: spoofable client IP behind proxy, phone layout and lost taps,
  stacked debriefs, station 5 rejected by server
- Raspberry Pi deploy script and .env.example
2026-11-22 09:15:08 +01:00

45 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import {
CLASSES,
createLoadout,
createShip,
createWorld,
hasHelicopter,
installAir,
installWeapons,
isEscort,
sendDip,
setTowedDecoy,
sourceLevel,
} from '../src/index.js';
describe('corvette and coastal submarine', () => {
it('the coastal boat is the quietest submarine, the corvette quieter than the frigate', () => {
const at = (cls: 'ssk' | 'ssc' | 'ffg' | 'kor', kn: number) => {
const s = createShip({ id: cls, cls, name: cls, pos: { x: 0, y: 0 }, heading: 0, speedKn: kn, depth: CLASSES[cls].submarine ? 60 : 0 });
s.speed = kn * 0.5144;
return sourceLevel(s);
};
expect(at('ssc', 4)).toBeLessThan(at('ssk', 4));
expect(at('kor', 15)).toBeLessThan(at('ffg', 15));
});
it('the corvette escorts and streams a decoy but carries no helicopter', () => {
expect(isEscort('kor')).toBe(true);
expect(hasHelicopter('kor')).toBe(false);
const kor = createShip({ id: 'k', cls: 'kor', name: 'K', pos: { x: 0, y: 0 }, heading: 0, speedKn: 12, team: 'west' });
const w = createWorld([kor], 1);
installWeapons(w);
installAir(w);
expect(sendDip(w, kor, { x: 3000, y: 3000 }, false)).toBe('Kein Hubschrauber an Bord');
setTowedDecoy(w, kor, true);
expect(w.weapons!.decoys.some((d) => d.towedBy === 'k')).toBe(true);
});
it('loadouts: corvette fires lightweights, the coastal boat has four loaded tubes', () => {
expect(createLoadout('kor').tubes.every((t) => t.loaded)).toBe(true);
expect(createLoadout('ssc').tubes).toHaveLength(4);
expect(createLoadout('ssc').heavy).toBe(2);
});
});