Skip to content

Commit

Permalink
feat: update napi + uncomment a few related tests (#4687)
Browse files Browse the repository at this point in the history
* feat: update napi

* test: uncomment some tests that actually work after napi's update
  • Loading branch information
jkomyno authored Feb 1, 2024
1 parent ddeb661 commit 2db61cf
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 66 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ uuid = { version = "1", features = ["serde"] }
indoc = "2.0.1"
itertools = "0.12"
connection-string = "0.2"
napi = { version = "2.14.2", default-features = false, features = [
napi = { version = "2.15.1", default-features = false, features = [
"napi8",
"tokio_rt",
"serde-json",
] }
napi-derive = "2.14.6"
napi-derive = "2.15.0"
js-sys = { version = "0.3" }
serde_repr = { version = "0.1.17" }
serde-wasm-bindgen = { version = "0.5" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,21 @@ mod string {
}
}

// Napi & Wasm DAs excluded because of a bytes bug
#[test_suite(
schema(schema),
only(Postgres("9", "10", "11", "12", "13", "14", "15", "pg.js", "neon.js"))
only(Postgres(
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"pg.js",
"pg.js.wasm",
"neon.js",
"neon.js.wasm"
))
)]
mod others {
fn schema_other_types() -> String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@ mod json_filter {
}

// 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)
)
)]
#[connector_test(schema(schema), exclude(MySQL(5.6)))]
async fn does_not_strip_nulls_in_json(runner: Runner) -> TestResult<()> {
run_query!(
&runner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ mod um_inside_update {
}

// "a PM to C1! relation" should "work"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToOneReq",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneReq")]
async fn pm_c1_req_should_work(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down Expand Up @@ -94,12 +89,7 @@ mod um_inside_update {
}

// "a PM to C1 relation " should "work"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToOneOpt",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneOpt")]
async fn pm_c1_should_work(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down Expand Up @@ -133,12 +123,7 @@ mod um_inside_update {
}

// "a PM to CM relation " should "work"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToMany",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToMany")]
async fn pm_cm_should_work(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down Expand Up @@ -172,12 +157,7 @@ mod um_inside_update {
}

// "a PM to C1! relation " should "work with several updateManys"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToOneReq",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneReq")]
async fn pm_c1_req_many_ums(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down Expand Up @@ -217,12 +197,7 @@ mod um_inside_update {
}

// "a PM to C1! relation " should "work with empty Filter"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToOneReq",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneReq")]
async fn pm_c1_req_empty_filter(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down Expand Up @@ -258,12 +233,7 @@ mod um_inside_update {
}

// "a PM to C1! relation " should "not change anything when there is no hit"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToOneReq",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneReq")]
async fn pm_c1_req_noop_no_hit(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down Expand Up @@ -305,12 +275,7 @@ mod um_inside_update {
// optional ordering

// "a PM to C1! relation " should "work when multiple filters hit"
// TODO: fix https://github.com/prisma/team-orm/issues/683 and then unexclude DAs
#[relation_link_test(
on_parent = "ToMany",
on_child = "ToOneReq",
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneReq")]
async fn pm_c1_req_many_filters(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let parent = setup_data(runner, t).await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ mod atomic_number_ops {
}

// "A nested updateOne mutation" should "correctly apply all number operations for Int"
#[connector_test(schema(schema_3), exclude(CockroachDb, Postgres("pg.js", "neon.js")))]
#[connector_test(schema(schema_3), exclude(CockroachDb))]
async fn nested_update_int_ops(runner: Runner) -> TestResult<()> {
create_test_model(&runner, 1, None, None).await?;
create_test_model(&runner, 2, Some(3), None).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ mod update_inside_update {
// ----------------------------------

// "A PM to C1 relation relation" should "work"
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneOpt", exclude(Postgres("pg.js", "neon.js")))]
#[relation_link_test(on_parent = "ToMany", on_child = "ToOneOpt")]
async fn pm_c1_should_work(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let res = run_query_json!(
runner,
Expand Down Expand Up @@ -384,7 +384,7 @@ mod update_inside_update {
// ----------------------------------

// "A PM to CM relation relation" should "work"
#[relation_link_test(on_parent = "ToMany", on_child = "ToMany", exclude(Postgres("pg.js", "neon.js")))]
#[relation_link_test(on_parent = "ToMany", on_child = "ToMany")]
async fn pm_cm_should_work(runner: &Runner, t: &DatamodelWithParams) -> TestResult<()> {
let res = run_query_json!(
runner,
Expand Down

0 comments on commit 2db61cf

Please sign in to comment.