Skip to content

Commit

Permalink
prisma-fmt: add a regression test for panic with multiSchema (#4089)
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed Jul 31, 2023
1 parent b3db4bf commit 2650ebd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions prisma-fmt/tests/regressions/language_tools_1473.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#[test]
fn code_actions_should_not_crash_on_validation_errors_with_multi_schema() {
let schema = r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["auth", "public"]
}
model A {
id Int @id
test
}
"#;

let params = lsp_types::CodeActionParams {
text_document: lsp_types::TextDocumentIdentifier {
uri: "file:/path/to/schema.prisma".parse().unwrap(),
},
range: lsp_types::Range::default(),
context: lsp_types::CodeActionContext::default(),
work_done_progress_params: lsp_types::WorkDoneProgressParams { work_done_token: None },
partial_result_params: lsp_types::PartialResultParams {
partial_result_token: None,
},
};

prisma_fmt::code_actions(schema.to_owned(), &serde_json::to_string_pretty(&params).unwrap());
}
1 change: 1 addition & 0 deletions prisma-fmt/tests/regressions/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
mod language_tools_1466;
mod language_tools_1473;

0 comments on commit 2650ebd

Please sign in to comment.