import { generateFlatbuffers } from "./generateFlatbufferSchema"; import { exampleEnum, exampleMessage } from "./testFixtures"; describe("generateFlatbuffers", () => { it("generates Message .fbs files", () => { expect(generateFlatbuffers(exampleMessage, [exampleEnum])).toMatchInlineSnapshot(` "// Generated by https://github.com/foxglove/schemas include "ByteVector.fbs"; include "Duration.fbs"; include "NestedMessage.fbs"; include "Time.fbs"; namespace foxglove; /// An example enum enum ExampleEnum : ubyte { /// Value A A = 0, /// Value B B = 1, } /// An example type table ExampleMessage { /// duration field field_duration:Duration; /// time field field_time:Time; /// boolean field field_boolean:bool = true; /// bytes field field_bytes:[uint8]; /// float64 field field_float64:double = 1.0; /// uint32 field field_uint32:uint32 = 5; /// string field field_string:string = "string-type"; /// duration array field field_duration_array:[Duration]; /// time array field field_time_array:[Time]; /// boolean array field field_boolean_array:[bool]; /// bytes array field field_bytes_array:[ByteVector]; /// float64 array field field_float64_array:[double]; /// uint32 array field field_uint32_array:[uint32]; /// string array field field_string_array:[string]; /// duration fixed-length array field /// length 3 field_duration_fixed_array:[Duration]; /// time fixed-length array field /// length 3 field_time_fixed_array:[Time]; /// boolean fixed-length array field /// length 3 field_boolean_fixed_array:[bool]; /// bytes fixed-length array field /// length 3 field_bytes_fixed_array:[ByteVector]; /// float64 fixed-length array field /// length 3 field_float64_fixed_array:[double]; /// uint32 fixed-length array field /// length 3 field_uint32_fixed_array:[uint32]; /// string fixed-length array field /// length 3 field_string_fixed_array:[string]; /// An enum field field_enum:ExampleEnum; /// An enum array field field_enum_array:[ExampleEnum]; /// A nested field field_nested:foxglove.NestedMessage; /// A nested array field /// With /// a /// very /// long /// description field_nested_array:[foxglove.NestedMessage]; } root_type ExampleMessage; " `); }); });