diff --git a/src/formatters/biome.rs b/src/formatters/biome.rs index a8d4a12..47c65d8 100644 --- a/src/formatters/biome.rs +++ b/src/formatters/biome.rs @@ -58,14 +58,14 @@ mod test_biome { #[test] fn it_should_format_javascript() { - let input = r#" + let input = " async function asyncAddition( a,b ) { return a+b } - "#; + "; let expected_output = "async function asyncAddition(a, b) { \treturn a + b; @@ -81,4 +81,33 @@ mod test_biome { assert_eq!(expected_output, output); } + + #[test] + fn it_should_format_typescript() { + let input = " + async function asyncAddition( + a:number,b:number + ) :Promise< +number> + { + return a+b + } + + "; + + let expected_output = + "async function asyncAddition(a: number, b: number): Promise { +\treturn a + b; +} +"; + + let snippet = setup_snippet(input, Language::TypeScript.to_file_ext()) + .expect("it to create a snippet file"); + + let output = format_using_biome(snippet.path()) + .expect("it to be succesful") + .expect("it to be some"); + + assert_eq!(expected_output, output); + } }