import { parseIdl } from "@foxglove/omgidl-parser"; import { DURATION_IDL, TIME_IDL, generateOmgIdl } from "./generateOmgIdl"; import { foxgloveEnumSchemas, foxgloveMessageSchemas } from "./schemas"; import { exampleEnum, exampleMessage } from "./testFixtures"; describe("generateOmgIdl", () => { it("generates .idl files", () => { expect(generateOmgIdl(exampleEnum)).toMatchInlineSnapshot(` "// Generated by https://github.com/foxglove/schemas module foxglove { // An example enum enum ExampleEnum { // Value A // Value: 0 A, // Value B // Value: 1 B }; }; " `); expect(generateOmgIdl(exampleMessage)).toMatchInlineSnapshot(` "// Generated by https://github.com/foxglove/schemas #include "foxglove/Duration.idl" #include "foxglove/ExampleEnum.idl" #include "foxglove/NestedMessage.idl" #include "foxglove/Time.idl" module foxglove { // An example type struct ExampleMessage { // duration field Duration field_duration; // time field Time field_time; // boolean field @default(TRUE) boolean field_boolean; // bytes field sequence field_bytes; // float64 field @default(1.0) double field_float64; // uint32 field @default(5) uint32 field_uint32; // string field @default("string-type") string field_string; // duration array field sequence field_duration_array; // time array field sequence