camstreamerlib 4.0.34-be26059 → 4.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,88 +0,0 @@
1
- import { cameraSettingsSchema } from './PlaneTrackerAPI';
2
- import { describe, test, expect } from '@jest/globals';
3
- const AIRCRAFT_LABEL = {
4
- firstRow: 'icao',
5
- secondRow: 'call_sign',
6
- thirdRow: 'blank',
7
- fourthRow: 'registration',
8
- opacity: 50,
9
- };
10
- const DEFAULT_DRONE_LABEL = { firstRow: 'remote_id', opacity: 30 };
11
- describe('cameraSettingsSchema identificationLabel', () => {
12
- test('defaults both aircraft and drone labels', () => {
13
- expect(cameraSettingsSchema.parse({}).identificationLabel).toEqual({
14
- aircraft: {
15
- firstRow: 'icao',
16
- secondRow: 'call_sign',
17
- thirdRow: 'blank',
18
- fourthRow: 'blank',
19
- opacity: 30,
20
- },
21
- drone: DEFAULT_DRONE_LABEL,
22
- });
23
- });
24
- test('parses the aircraft and drone label', () => {
25
- const identificationLabel = { aircraft: AIRCRAFT_LABEL, drone: { firstRow: 'blank', opacity: 70 } };
26
- expect(cameraSettingsSchema.parse({ identificationLabel }).identificationLabel).toEqual(identificationLabel);
27
- });
28
- test('defaults a missing drone label', () => {
29
- expect(cameraSettingsSchema.parse({ identificationLabel: { aircraft: AIRCRAFT_LABEL } }).identificationLabel).toEqual({ aircraft: AIRCRAFT_LABEL, drone: DEFAULT_DRONE_LABEL });
30
- });
31
- test('converts the legacy flat label to the aircraft label', () => {
32
- expect(cameraSettingsSchema.parse({ identificationLabel: AIRCRAFT_LABEL }).identificationLabel).toEqual({
33
- aircraft: AIRCRAFT_LABEL,
34
- drone: DEFAULT_DRONE_LABEL,
35
- });
36
- });
37
- test('returns an independent drone label for each legacy parse', () => {
38
- const first = cameraSettingsSchema.parse({ identificationLabel: AIRCRAFT_LABEL });
39
- first.identificationLabel.drone.opacity = 90;
40
- const second = cameraSettingsSchema.parse({ identificationLabel: AIRCRAFT_LABEL });
41
- expect(second.identificationLabel.drone).toEqual(DEFAULT_DRONE_LABEL);
42
- });
43
- test('rejects an unknown drone label row', () => {
44
- const identificationLabel = { aircraft: AIRCRAFT_LABEL, drone: { firstRow: 'icao', opacity: 30 } };
45
- expect(cameraSettingsSchema.safeParse({ identificationLabel }).success).toBe(false);
46
- });
47
- });
48
- const CAPTURE_CONFIG = { defaultCaptureSizeMeters: 50, captureSizeExtensionMeters: 20 };
49
- const DEFAULT_CAPTURE_CONFIG = { defaultCaptureSizeMeters: 120, captureSizeExtensionMeters: 80 };
50
- describe('cameraSettingsSchema cameraConfig', () => {
51
- test('defaults both aircraft and drone capture config', () => {
52
- expect(cameraSettingsSchema.parse({}).cameraConfig).toEqual({
53
- aircraft: DEFAULT_CAPTURE_CONFIG,
54
- drone: DEFAULT_CAPTURE_CONFIG,
55
- });
56
- });
57
- test('parses independent aircraft and drone capture config', () => {
58
- const cameraConfig = {
59
- aircraft: CAPTURE_CONFIG,
60
- drone: { defaultCaptureSizeMeters: 5, captureSizeExtensionMeters: 3 },
61
- };
62
- expect(cameraSettingsSchema.parse({ cameraConfig }).cameraConfig).toEqual(cameraConfig);
63
- });
64
- test('defaults a missing drone capture config', () => {
65
- expect(cameraSettingsSchema.parse({ cameraConfig: { aircraft: CAPTURE_CONFIG } }).cameraConfig).toEqual({
66
- aircraft: CAPTURE_CONFIG,
67
- drone: DEFAULT_CAPTURE_CONFIG,
68
- });
69
- });
70
- test('copies the legacy flat capture config to both aircraft and drone', () => {
71
- expect(cameraSettingsSchema.parse({ cameraConfig: CAPTURE_CONFIG }).cameraConfig).toEqual({
72
- aircraft: CAPTURE_CONFIG,
73
- drone: CAPTURE_CONFIG,
74
- });
75
- });
76
- test('returns independent aircraft and drone objects', () => {
77
- const legacy = cameraSettingsSchema.parse({ cameraConfig: CAPTURE_CONFIG }).cameraConfig;
78
- legacy.drone.defaultCaptureSizeMeters = 1;
79
- expect(legacy.aircraft).toEqual(CAPTURE_CONFIG);
80
- const first = cameraSettingsSchema.parse({}).cameraConfig;
81
- first.drone.defaultCaptureSizeMeters = 1;
82
- expect(cameraSettingsSchema.parse({}).cameraConfig.drone).toEqual(DEFAULT_CAPTURE_CONFIG);
83
- });
84
- test('rejects a non-positive drone capture size', () => {
85
- const cameraConfig = { aircraft: CAPTURE_CONFIG, drone: { ...CAPTURE_CONFIG, defaultCaptureSizeMeters: 0 } };
86
- expect(cameraSettingsSchema.safeParse({ cameraConfig }).success).toBe(false);
87
- });
88
- });
@@ -1 +0,0 @@
1
- export {};