-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixedWingConfigs.test.ts
More file actions
120 lines (107 loc) · 4.68 KB
/
Copy pathFixedWingConfigs.test.ts
File metadata and controls
120 lines (107 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (c) 2025-2026 Matthew Kissinger
import { describe, it, expect } from 'vitest';
import {
FIXED_WING_CONFIGS,
getFixedWingDisplayInfo,
getFixedWingCatalogEntry,
getDormantFixedWingKeys,
getDormantFixedWingInfo,
} from './FixedWingConfigs';
describe('FixedWingDisplayInfo — repaint axis convention', () => {
it('no flyable airframe overrides modelYawOffset (repaint fleet is uniformly +Z-forward)', () => {
// The repaint GLBs are all +Z-forward per the war-asset catalog, so the
// universal Math.PI flip at load handles every airframe — none override.
for (const key of ['A1_SKYRAIDER', 'AC47_SPOOKY', 'F4_PHANTOM']) {
const display = getFixedWingDisplayInfo(key);
expect(display).not.toBeNull();
expect(display!.modelYawOffset).toBeUndefined();
}
});
it('every flyable airframe is cataloged +Z-forward (so the flip is correct)', () => {
for (const key of ['A1_SKYRAIDER', 'AC47_SPOOKY', 'F4_PHANTOM']) {
const entry = getFixedWingCatalogEntry(key);
expect(entry).not.toBeNull();
expect(entry!.forward).toBe('pos-z');
}
});
});
describe('FixedWingDisplayInfo — propeller spin from grafted catalog joints', () => {
it('the A-1 spins its single grafted propeller hub around the catalog axis', () => {
const display = getFixedWingDisplayInfo('A1_SKYRAIDER')!;
expect(display.hasPropellers).toBe(true);
// Sourced from the importer-grafted hub joint, not a fuzzy "propeller" name.
expect(display.propellerNodes).toContain('Joint_Propeller');
expect(display.propellerNodes.length).toBeGreaterThan(0);
expect(display.propellerSpinAxis).toBe('x');
});
it('the AC-47 spins both grafted propeller hubs', () => {
const display = getFixedWingDisplayInfo('AC47_SPOOKY')!;
expect(display.hasPropellers).toBe(true);
expect(display.propellerNodes).toEqual(
expect.arrayContaining(['Joint_PropellerR', 'Joint_PropellerL']),
);
expect(display.propellerSpinAxis).toBe('x');
});
it('the F-4 jet carries no propeller nodes', () => {
const display = getFixedWingDisplayInfo('F4_PHANTOM')!;
expect(display.hasPropellers).toBe(false);
expect(display.propellerNodes).toHaveLength(0);
});
it('propeller node names match the airframe catalog joints', () => {
for (const key of ['A1_SKYRAIDER', 'AC47_SPOOKY']) {
const display = getFixedWingDisplayInfo(key)!;
const entry = getFixedWingCatalogEntry(key)!;
const catalogPropNames = (entry.joints ?? [])
.filter((j) => j.name.startsWith('Joint_Propeller'))
.map((j) => j.name);
expect(display.propellerNodes).toEqual(catalogPropNames);
}
});
});
describe('FixedWingConfigs — gear clearance seats on measured catalog dims', () => {
it('parks each airframe so its lowest mesh point (catalog minY) touches the ground', () => {
// gearClearance is the origin-above-ground offset; it must equal -minY so the
// GLB's lowest point sits exactly on the runway (no float, no ground-clip).
for (const key of ['A1_SKYRAIDER', 'AC47_SPOOKY', 'F4_PHANTOM']) {
const entry = getFixedWingCatalogEntry(key)!;
const config = FIXED_WING_CONFIGS[key];
expect(config.physics.gearClearance).toBeCloseTo(-entry.minY, 2);
}
});
it('the AC-47 parked clearance is driven by landing gear, not misplaced propeller tips', () => {
expect(FIXED_WING_CONFIGS.AC47_SPOOKY.physics.gearClearance)
.toBeLessThan(0.5);
});
});
describe('FixedWingConfigs — dormant repaint registrations', () => {
it('registers the net-new airframes as dormant (cataloged, not yet flyable)', () => {
const keys = getDormantFixedWingKeys();
expect(keys).toEqual(
expect.arrayContaining([
'B52_STRATOFORTRESS',
'C130_HERCULES',
'OV10_BRONCO',
'A37_DRAGONFLY',
'MIG17_NVA',
]),
);
});
it('dormant airframes carry no flight config (not spawnable as flyable)', () => {
for (const key of getDormantFixedWingKeys()) {
expect(FIXED_WING_CONFIGS[key]).toBeUndefined();
}
});
it('dormant airframes are not resolved as flyable catalog slugs', () => {
for (const key of getDormantFixedWingKeys()) {
const info = getDormantFixedWingInfo(key)!;
expect(info.displayName.length).toBeGreaterThan(0);
// Dormant keys are not in the flyable slug map (only A1/AC47/F4 are).
expect(getFixedWingCatalogEntry(key)).toBeNull();
}
});
it('flags the A-37 Dragonfly for a scale re-roll advisory', () => {
expect(getDormantFixedWingInfo('A37_DRAGONFLY')!.scaleRerollAdvisory).toBe(true);
expect(getDormantFixedWingInfo('B52_STRATOFORTRESS')!.scaleRerollAdvisory).toBe(false);
});
});