Skip to content

Commit

Permalink
test(qe): stop distinguishing for mongodb in onUpdate/onDelete NoActi…
Browse files Browse the repository at this point in the history
…on tests
  • Loading branch information
jkomyno committed Oct 11, 2022
1 parent 2bf70e0 commit 9e7c053
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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 }}"#),
Expand All @@ -45,6 +45,8 @@ mod one2one_req {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Deleting the parent leaves the data in a integrity-violating state.
#[connector_test(only(MongoDb))]
async fn delete_parent_violation(runner: Runner) -> TestResult<()> {
Expand All @@ -65,9 +67,11 @@ mod one2one_req {
Ok(())
}
*/
}

#[test_suite(suite = "noaction_onD_1to1_opt", schema(optional), exclude(MongoDb))]
#[test_suite(suite = "noaction_onD_1to1_opt", schema(optional))]
mod one2one_opt {
fn optional() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -137,6 +141,8 @@ mod one2one_opt {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Deleting the parent leaves the data in a integrity-violating state.
#[connector_test(only(MongoDb))]
async fn delete_parent_violation(runner: Runner) -> TestResult<()> {
Expand All @@ -157,9 +163,11 @@ mod one2one_opt {
Ok(())
}
*/
}

#[test_suite(suite = "noaction_onD_1toM_req", schema(required), exclude(MongoDb))]
#[test_suite(suite = "noaction_onD_1toM_req", schema(required))]
mod one2many_req {
fn required() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -229,6 +237,8 @@ mod one2many_req {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Deleting the parent leaves the data in a integrity-violating state.
#[connector_test(only(MongoDb))]
async fn delete_parent_violation(runner: Runner) -> TestResult<()> {
Expand All @@ -249,9 +259,11 @@ mod one2many_req {
Ok(())
}
*/
}

#[test_suite(suite = "noaction_onD_1toM_opt", schema(optional), exclude(MongoDb))]
#[test_suite(suite = "noaction_onD_1toM_opt", schema(optional))]
mod one2many_opt {
fn optional() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -321,6 +333,8 @@ mod one2many_opt {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Deleting the parent leaves the data in a integrity-violating state.
#[connector_test(only(MongoDb))]
async fn delete_parent_violation(runner: Runner) -> TestResult<()> {
Expand All @@ -341,4 +355,6 @@ mod one2many_opt {
Ok(())
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod one2one_req {
}

/// Updating the parent must fail if a child is connected.
#[connector_test(exclude(MongoDb))]
#[connector_test]
async fn update_parent_failure(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", child: { create: { id: 1 }}}) { id }}"#),
Expand All @@ -46,6 +46,8 @@ mod one2one_req {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Updating the parent leaves the data in a integrity-violating state.
/// All supported dbs except mongo throw key violations.
#[connector_test(only(MongoDb))]
Expand Down Expand Up @@ -111,6 +113,8 @@ mod one2one_req {
Ok(())
}
*/
}

#[test_suite(suite = "noaction_onU_1to1_opt", schema(optional))]
Expand All @@ -134,7 +138,7 @@ mod one2one_opt {
}

/// Updating the parent must fail if a child is connected.
#[connector_test(exclude(MongoDb))]
#[connector_test]
async fn update_parent_failure(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", child: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -200,6 +204,8 @@ mod one2one_opt {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Updating the parent leaves the data in a integrity-violating state.
/// All supported dbs except mongo throw key violations.
#[connector_test(only(MongoDb))]
Expand Down Expand Up @@ -265,6 +271,8 @@ mod one2one_opt {
Ok(())
}
*/
}

#[test_suite(suite = "noaction_onU_1toM_req", schema(required))]
Expand All @@ -288,7 +296,7 @@ mod one2many_req {
}

/// Updating the parent must fail if a child is connected.
#[connector_test(exclude(MongoDb))]
#[connector_test]
async fn update_parent_failure(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", children: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -338,6 +346,8 @@ mod one2many_req {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Updating the parent leaves the data in a integrity-violating state.
#[connector_test(only(MongoDb))]
async fn update_parent_violation(runner: Runner) -> TestResult<()> {
Expand Down Expand Up @@ -402,6 +412,8 @@ mod one2many_req {
Ok(())
}
*/
}

#[test_suite(suite = "noaction_onU_1toM_opt", schema(optional))]
Expand All @@ -425,7 +437,7 @@ mod one2many_opt {
}

/// Updating the parent must fail if a child is connected.
#[connector_test(exclude(MongoDb))]
#[connector_test]
async fn update_parent_failure(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", children: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -475,6 +487,8 @@ mod one2many_opt {
Ok(())
}

/* keeping these tests for when onUpdate/onDelete: Nothing is implemented for relationMode = "prisma"
/// Updating the parent leaves the data in a integrity-violating state.
#[connector_test(only(MongoDb))]
async fn update_parent_violation(runner: Runner) -> TestResult<()> {
Expand Down Expand Up @@ -539,4 +553,6 @@ mod one2many_opt {
Ok(())
}
*/
}

0 comments on commit 9e7c053

Please sign in to comment.