Skip to content

Commit

Permalink
Merge branch 'patch-2' of github.com:joscha/avsc into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Sep 24, 2024
2 parents 040aed7 + b540798 commit 87faea2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- '18'
name: Test using node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Node ${{ matrix.node }}
shell: bash -eo pipefail -l {0}
run: |
Expand Down
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

0 comments on commit 87faea2

Please sign in to comment.