diff --git a/test/test_types.js b/test/test_types.js index 4578d7d2..e7675761 100644 --- a/test/test_types.js +++ b/test/test_types.js @@ -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'});