Comparing version
/// <reference types="node" /> | ||
import { Type, Schema } from 'avsc'; | ||
declare type FieldTypes = string | string[] | { | ||
declare type FieldTypes = string | string[] | Schema | { | ||
type: 'array'; | ||
@@ -5,0 +5,0 @@ items: Schema; |
@@ -46,2 +46,22 @@ "use strict"; | ||
}); | ||
it('Should extract single nested field', () => __awaiter(void 0, void 0, void 0, function* () { | ||
let SyncBlock = class SyncBlock extends _1.Avro { | ||
constructor(base) { | ||
super(); | ||
this.block = new Block(base === null || base === void 0 ? void 0 : base.block); | ||
} | ||
}; | ||
__decorate([ | ||
(0, _1.AvroField)(Block.schema) | ||
], SyncBlock.prototype, "block", void 0); | ||
SyncBlock = __decorate([ | ||
(0, _1.AvroSchema)({ namespace: 'evm' }) | ||
], SyncBlock); | ||
const sync = new SyncBlock({ | ||
block: { number: 1, hash: '0x0101' }, | ||
}); | ||
const encoded = yield sync.encode(); | ||
const decoded = yield SyncBlock.decode(encoded); | ||
expect(decoded).toEqual(sync); | ||
})); | ||
it('Should extract nested fields', () => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -48,0 +68,0 @@ let Log = class Log extends _1.Avro { |
{ | ||
"name": "avsc-tsc", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Utility library to encode and decode typescript classes in Avro format", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
20010
7.95%264
8.2%