feat(flight-finder): implement milestone M1 - domain model and skill contract

This commit is contained in:
2026-03-30 16:45:40 -05:00
parent 57f6b132b2
commit 9c7103770a
1237 changed files with 901934 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import assert from 'assert';
import {Boolean, uint8, DecodeStream, EncodeStream} from 'restructure';
describe('Boolean', function() {
describe('decode', function() {
it('should decode 0 as false', function() {
const buffer = new Uint8Array([0]);
const boolean = new Boolean(uint8);
assert.deepEqual(boolean.fromBuffer(buffer), false);
});
it('should decode 1 as true', function() {
const buffer = new Uint8Array([1]);
const boolean = new Boolean(uint8);
assert.deepEqual(boolean.fromBuffer(buffer), true);
});
});
describe('size', () =>
it('should return given type size', function() {
const boolean = new Boolean(uint8);
assert.deepEqual(boolean.size(), 1);
})
);
describe('encode', function() {
it('should encode false as 0', function() {
const boolean = new Boolean(uint8);
const buffer = boolean.toBuffer(false);
assert.deepEqual(buffer, Buffer.from([0]));
});
it('should encode true as 1', function() {
const boolean = new Boolean(uint8);
const buffer = boolean.toBuffer(true);
assert.deepEqual(buffer, Buffer.from([1]));
});
});
});