Skip to content

Commit

Permalink
test(typescript): validate biome
Browse files Browse the repository at this point in the history
  • Loading branch information
hougesen committed Mar 7, 2024
1 parent e773d89 commit 8adfaac
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/formatters/biome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<number> {
\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);
}
}

0 comments on commit 8adfaac

Please sign in to comment.