From bc5cb987004c0b79266ce74670101fb426619072 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Tue, 24 Sep 2024 12:55:06 +1000 Subject: [PATCH 1/2] Update checkout action version (#478) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 666ab4f4..9f6bb514 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | From 14886e84f6505248b0a6513b173df0a228738d66 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Tue, 24 Sep 2024 13:04:26 +1000 Subject: [PATCH 2/2] Add synthetic constructor test (#477) --- test/test_types.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_types.js b/test/test_types.js index 888a2143..0ad09672 100644 --- a/test/test_types.js +++ b/test/test_types.js @@ -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', () => {