Skip to content

Commit

Permalink
test: add test for wrapUnions returning undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Sep 28, 2024
1 parent 52873d0 commit 7629f6b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -3546,6 +3546,16 @@ suite('types', () => {
assert.throws(() => Animal.toBuffer({ snap: '🐊' }), /Unknown animal/)
});

test('union projection with fallback', () => {
let t = Type.forSchema({
type: 'record',
fields: [
{name: 'wrapped', type: ['int', 'double' ]}, // Ambiguous.
]
}, {wrapUnions: () => undefined });
assert(Type.isType(t.field('wrapped').type, 'union:wrapped'));
});

test('invalid wrap unions option', () => {
assert.throws(() => {
Type.forSchema('string', {wrapUnions: 'FOO'});
Expand Down

0 comments on commit 7629f6b

Please sign in to comment.