FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
serializers.test.ts
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
3
4import { describe, expect, test } from 'bun:test';
5import { serializeAntenna } from './serializers';
6import type { Antenna } from './types';
7
8describe('serializeAntenna', () => {
9 test('uses an isotropic backend placeholder while an H5 antenna has no filename', () => {
10 const antenna: Antenna = {
11 id: '1',
12 type: 'Antenna',
13 name: 'Draft H5',
14 pattern: 'file',
15 filename: ' ',
16 efficiency: 0.8,
17 meshScale: 1,
18 design_frequency: null,
19 };
20
21 expect(serializeAntenna(antenna)).toEqual({
22 id: '1',
23 name: 'Draft H5',
24 pattern: 'isotropic',
25 efficiency: 0.8,
26 });
27 });
28
29 test('preserves H5 antenna payload once a filename is present', () => {
30 const antenna: Antenna = {
31 id: '2',
32 type: 'Antenna',
33 name: 'Loaded H5',
34 pattern: 'file',
35 filename: '/tmp/pattern.h5',
36 efficiency: 1,
37 meshScale: 1,
38 design_frequency: null,
39 };
40
41 expect(serializeAntenna(antenna)).toEqual({
42 id: '2',
43 name: 'Loaded H5',
44 pattern: 'file',
45 filename: '/tmp/pattern.h5',
46 efficiency: 1,
47 });
48 });
49});