chai-avro
v0.0.2
Published
Plugin to use Avro schemas together with the chaijs testing framework
Downloads
12
Readme
chai-avro
A chaijs plugin to use Avro schema definitions in tests
Info
This is a very simple plugin to use the Avro schemas within the chaijs testing framework, which allows for easily testing against schemas. Behind the scenes it is based on the Avro implementation from AVSC. Currently only supports loading protocols from Avro IDL files (*.avdl).
Usage
Load chai and chai-avro modules
const chai = require('chai');
const chaiAvro = require('chai-avro');
chai.use(chaiAvro);
Load an Avro protocol from IDL (*.avdl) file (e.g. in before handler in mocha)
chaiAvro
.loadProtocol('./com/example/types/MyProtocolFile.avdl')
.then(function() {
// start tests
});
Test your objects against the Avro schema, using your favorite style
expect(obj).to.be.a.avroType('com.example.types.Foo');
assert.isAvroType(obj, 'com.example.types.Foo');
For real-world examples see docs/example-mochajs.md.
About
by Rico Pfaus | (c) 2016 | MIT licensed