Skip to content
Merged
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
13 changes: 13 additions & 0 deletions test/test_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,19 @@ suite('types', () => {
function hook(path) { paths.push(path); }
});

// via https://github.com/mtth/avsc/pull/469
test('synthetic constructor', () => {
const name = 'Foo';
const type = types.Type.forSchema([
'null',
{type: 'record', name: `test.${name}`, fields: [{name: 'id', type: 'string'}]},
]);

const data = {id: 'abc'};
const roundtripped = type.fromBuffer(type.toBuffer(data));
assert.equal(roundtripped.constructor.name, name);
assert.deepEqual(roundtripped, data);
})
});

suite('EnumType', () => {
Expand Down