UNPKG

node-test-bed-adapter

Version:

An adapter to connect a node.js application to the Test-bed's Common Information Space or Common Simulation Space.

40 lines 2.05 kB
// import { avroHelperFactory } from './../../lib/avro/avro-helper-factory'; // import * as amberAlert from '../../../data/cap/examples/example_amber_alert.json'; // import * as earthquakeAlert from '../../../data/cap/examples/example_earthquake.json'; // import * as thunderstormAlert from '../../../data/cap/examples/example_thunderstorm.json'; // import * as homelandSecurityAlert from '../../../data/cap/examples/example_homeland_security.json'; export {}; // describe('AVRO Helper Factory', () => { // // // it('should throw when there is no schema file', () => { // // // const foo = () => avroHelperFactory(''); // // // expect(foo).toThrow(); // // // }); // // it('should validate messages', () => { // // const avro = avroHelperFactory('./data/cap/cap.avsc', 'driver.eu.alert'); // // expect(avro.isValid).toBeDefined(); // // const aa = avro.isValid(amberAlert); // // expect(aa).toBeTruthy(); // // const ea = avro.isValid(earthquakeAlert); // // expect(ea).toBeTruthy(); // // const ta = avro.isValid(thunderstormAlert); // // expect(ta).toBeTruthy(); // // const ha = avro.isValid(homelandSecurityAlert); // // expect(ha).toBeTruthy(); // // }); // // it('should encode and decode messages', () => { // // const avro = avroHelperFactory('./data/cap/cap.avsc', 'driver.eu.alert'); // // expect(avro.encode).toBeDefined(); // // expect(avro.decode).toBeDefined(); // // const aa = avro.encode(amberAlert); // // expect(aa).toBeTruthy(); // // const aad = avro.decode(aa); // // expect(avro.toString(aad)).toEqual(JSON.stringify(amberAlert)); // // const ae = avro.encode(earthquakeAlert); // // expect(ae).toBeTruthy(); // // const aed = avro.decode(ae); // // // Default properties are added automatically, and cause the comparison to fail // // delete (aed as any).info.language; // // expect(avro.toString(aed)).toEqual(JSON.stringify(earthquakeAlert)); // // }); // }); //# sourceMappingURL=avro-helper-factory.spec.mjs.map