Skip to content

Commit

Permalink
test(driver-adapters): ensure JSON nulls are NOT stripped out on Wasm (
Browse files Browse the repository at this point in the history
…#4654)

* test(driver-adapters): ensure JSON nulls are NOT stripped out on Wasm

* fix(query-engine): update tests to exclude proper MySQL 5.6 tag

* chore: fix mysql 5.6 failures
  • Loading branch information
jkomyno authored Jan 19, 2024
1 parent 9c3f205 commit ec17f10
Showing 1 changed file with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use query_engine_tests::*;

#[test_suite(capabilities(JsonFiltering), exclude(MySql(5.6)))]
#[test_suite(capabilities(JsonFiltering), exclude(MySQL(5.6)))]
mod json_filter {
use query_engine_tests::run_query;

Expand All @@ -17,6 +17,37 @@ mod json_filter {
schema.to_owned()
}

// Note: testing the absence of "JSON-null stripping" in Napi.rs Driver Adapters requires patching napi.rs.
// Please see: https://github.com/prisma/team-orm/issues/683#issuecomment-1898305228.
#[connector_test(
schema(schema),
exclude(
Postgres("pg.js"),
Postgres("neon.js"),
Sqlite("libsql.js"),
Vitess("planetscale.js"),
MySQL(5.6)
)
)]
async fn does_not_strip_nulls_in_json(runner: Runner) -> TestResult<()> {
run_query!(
&runner,
r#"mutation { createOneTestModel(data: { id: 1, json: "{\"a\":null}"}) { id } }"#
);

insta::assert_snapshot!(
run_query!(&runner, r#"{
findManyTestModel {
id
json
}
}"#),
@r###"{"data":{"findManyTestModel":[{"id":1,"json":"{\"a\":null}"}]}}"###
);

Ok(())
}

#[connector_test(schema(schema))]
async fn basic_where(runner: Runner) -> TestResult<()> {
test_data(&runner).await?;
Expand Down

0 comments on commit ec17f10

Please sign in to comment.