Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions ui/src/utils/packetTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,12 @@ describe('formatPacketType', () => {
).toBe('Raw Video (1920x1080, Rgba8)');
});

it('renders null-valued RawVideo fields literally (template renderer ignores null wildcard_value)', () => {
// See PR follow-up note: `formatWithTemplate` short-circuits when the meta's
// `wildcard_value` is null, so null-valued fields render as the literal string "null"
// rather than "*". `canConnectPair` does NOT have this asymmetry — it correctly
// treats null as a valid wildcard. This test pins the current behavior; do not
// change the assertion without also auditing the renderer.
it('renders null-valued RawVideo wildcard fields as *', () => {
expect(
formatPacketType({
RawVideo: { width: null, height: null, pixel_format: 'Rgba8' },
})
).toBe('Raw Video (nullxnull, Rgba8)');
).toBe('Raw Video (*x*, Rgba8)');
});

it('renders the Custom template with the supplied type_id', () => {
Expand Down
5 changes: 2 additions & 3 deletions ui/src/utils/packetTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ function formatWithTemplate(
let isWildcard = false;
if (compat && compat.kind === 'structfieldwildcard') {
const rule = compat.fields.find((f) => f.name === field);
const wildcard = rule?.wildcard_value;
if (wildcard !== undefined && wildcard !== null) {
isWildcard = deepEqual(value, wildcard);
if (rule && 'wildcard_value' in rule) {
isWildcard = deepEqual(value, rule.wildcard_value);
}
}
if (isWildcard) return '*';
Expand Down
Loading