()
| 11 | |
| 12 | #[test] |
| 13 | fn index() -> io::Result<()> { |
| 14 | let collection = TypeCollection::default(); |
| 15 | |
| 16 | let settings = TypeScriptGeneratorSettings::default(); |
| 17 | let mut generator = TypeScriptGenerator::new(&settings, &collection); |
| 18 | |
| 19 | for (type_id, _, type_definition) in collection.iter() { |
| 20 | if type_definition.module.starts_with("hash_codec") { |
| 21 | generator.add_type_declaration_by_id(type_id); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | insta::with_settings!({ |
| 26 | description => "Generated TS types", |
| 27 | omit_expression => true, |
| 28 | snapshot_path => "../types", |
| 29 | prepend_module_to_snapshot => false, |
| 30 | }, { |
| 31 | insta::assert_binary_snapshot!( |
| 32 | ".d.ts", |
| 33 | format!("// This file was generated from `{}`\n\n{}", file!(), generator.write()).into_bytes() |
| 34 | ); |
| 35 | }); |
| 36 | |
| 37 | // We require a `.js` file as otherwise `tsc` won't find the `.d.ts` file |
| 38 | let _: fs::File = fs::File::options() |
| 39 | .create(true) |
| 40 | .write(true) |
| 41 | .truncate(true) |
| 42 | .open( |
| 43 | Path::new(env!("CARGO_MANIFEST_DIR")) |
| 44 | .join("types") |
| 45 | .join("index.snap.js"), |
| 46 | )?; |
| 47 | |
| 48 | Ok(()) |
| 49 | } |
nothing calls this directly
no test coverage detected