fix(qe): refactor onDelete noAction tests to use referentialMode = 'prisma'
use indoc::indoc;
use query_engine_tests::*;
-#[test_suite(suite = "noaction_onD_1to1_req", schema(required))]
+#[test_suite(suite = "noaction_onD_1to1_req", schema(required), relation_mode = "prisma")]
mod one2one_req {
fn required() -> String {
let schema = indoc! {
@@ -21,38 +21,13 @@ mod one2one_req {
}
/// Deleting the parent must fail if a child is connected.
- #[connector_test(exclude(MongoDb))]
+ #[connector_test]
async fn delete_parent_failure(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, child: { create: { id: 1 }}}) { id }}"#),
@r###"{"data":{"createOneParent":{"id":1}}}"###
);
- assert_error!(
- runner,
- "mutation { deleteOneParent(where: { id: 1 }) { id }}",
- 2003,
- "Foreign key constraint failed on the field"
- );
-
- assert_error!(
- runner,
- "mutation { deleteManyParent(where: { id: 1 }) { count }}",
- 2003,
- "Foreign key constraint failed on the field"
- );
-
- Ok(())
- }
-
- /// Deleting the parent must fail if a child is connected.
- #[connector_test(only(MongoDb))]
- async fn delete_parent_violation(runner: Runner) -> TestResult<()> {
- insta::assert_snapshot!(
- run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, child: { create: { id: 1 }}}) { id }}"#),
- @r###"{"data":{"createOneParent":{"id":1}}}"###
- );
-
assert_error!(
runner,
"mutation { deleteOneParent(where: { id: 1 }) { id }}",
@@ -165,7 +140,7 @@ mod one2one_opt {
}
}
-#[test_suite(suite = "noaction_onD_1toM_req", schema(required), exclude(MongoDb))]
+#[test_suite(suite = "noaction_onD_1toM_req", schema(required), relation_mode = "prisma")]
mod one2many_req {
fn required() -> String {
let schema = indoc! {
@@ -236,7 +211,7 @@ mod one2many_req {
}
/// Deleting the parent leaves the data in a integrity-violating state.
- #[connector_test(only(MongoDb))]
+ #[connector_test]
async fn delete_parent_violation(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, children: { create: { id: 1 }}}) { id }}"#),
