Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-prisma committed Dec 16, 2024
1 parent 171538d commit b634608
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 38 deletions.
2 changes: 1 addition & 1 deletion psl/psl/tests/base/base_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ fn json_type_must_work_for_some_connectors() {
.assert_has_scalar_field("json")
.assert_scalar_type(ScalarType::Json);

let error = parse_unwrap_err(&format!("{SQLITE_SOURCE}\n{dml}"));
let error = parse_unwrap_err(&format!("{MSSQL_SOURCE}\n{dml}"));

let expectation = expect![[r#"
error: Error validating field `json` in model `User`: Field `json` in model `User` can't be of type Json. The current connector does not support the Json type.
Expand Down
29 changes: 0 additions & 29 deletions psl/psl/tests/capabilities/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,35 +108,6 @@ fn unique_index_names_support() {
expectation.assert_eq(&error);
}

#[test]
fn json_support() {
let dml = indoc! {r#"
datasource db {
provider = "sqlite"
url = "file:test.db"
}
model User {
id Int @id
data Json
}
"#};

let error = parse_unwrap_err(dml);

let expectation = expect![[r#"
error: Error validating field `data` in model `User`: Field `data` in model `User` can't be of type Json. The current connector does not support the Json type.
--> schema.prisma:8
 | 
 7 |  id Int @id
 8 |  data Json
 9 | }
 | 
"#]];

expectation.assert_eq(&error);
}

#[test]
fn non_unique_relation_criteria_support() {
let dml = indoc! {r#"
Expand Down
14 changes: 7 additions & 7 deletions psl/psl/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ pub(crate) fn assert_valid(schema: &str) {
}
}

pub(crate) const SQLITE_SOURCE: &str = r#"
datasource db {
provider = "sqlite"
url = "file:dev.db"
}
"#;

pub(crate) const POSTGRES_SOURCE: &str = r#"
datasource db {
provider = "postgres"
Expand All @@ -85,3 +78,10 @@ pub(crate) const MYSQL_SOURCE: &str = r#"
url = "mysql://localhost:3306"
}
"#;

pub(crate) const MSSQL_SOURCE: &str = r#"
datasource db {
provider = "sqlserver"
url = "jdbc:sqlserver://localhost:3306"
}
"#;
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod json {

insta::assert_snapshot!(
res.to_string(),
@r###"{"data":{"findManyTestModel":[{"json":{"$type":"Json","value":"{}"}},{"json":{"$type":"Json","value":"{\"a\":\"b\"}"}},{"json":{"$type":"Json","value":"1"}},{"json":{"$type":"Json","value":"\"hello\""}},{"json":{"$type":"Json","value":"[1,\"a\",{\"b\":true}]"}}]}}"###
@r###"{"data":{"findManyTestModel":[{"json":{"$type":"Json","value":"{}"}},{"json":{"$type":"Json","value":"{\"a\":\"b\"}"}},{"json":{"$type":"Json","value":"1"}}{"json":{"$type":"Json","value":"1.5"}},{"json":{"$type":"Json","value":"\"hello\""}},{"json":{"$type":"Json","value":"[1,\"a\",{\"b\":true}]"}}]}}"###
);
}
}
Expand Down

0 comments on commit b634608

Please sign in to comment.