Skip to content

Commit

Permalink
Bonus tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Hammond authored and Nathan Hammond committed Jul 18, 2023
1 parent 8d59124 commit 59e6c4e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/turborepo-lib/src/rewrite_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,17 @@ mod test {
&["experimentalSpaces", "id"],
Some("{ \"before\": {}, \"experimentalSpaces\": { }, \"experimentalSpaces\": { }, \"after\": {} }")
),
adjacent_nodes: (
r#"{ "before": {}, "experimentalSpaces": { "id": "one" }, "experimentalSpaces": { "id": "two" }, "after": {} }"#,
&["experimentalSpaces"],
Some("{ \"before\": {},\"after\": {} }")
),
adjacent_nodes_trailing_comma: (
r#"{ "before": {}, "experimentalSpaces": { "id": "one" }, "experimentalSpaces": { "id": "two" }, }"#,
&["experimentalSpaces"],
// If it had a trailing comma to start, it may continue to have one.
Some("{ \"before\": {}, }")
),
parent_node: (
r#"{ "before": {}, "experimentalSpaces": { "id": "one" }, "middle": {}, "experimentalSpaces": { "id": "two" }, "after": {} }"#,
&["experimentalSpaces"],
Expand Down

0 comments on commit 59e6c4e

Please sign in to comment.