Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cases improvement #1811

Merged
merged 23 commits into from Aug 18, 2023
Merged

Test cases improvement #1811

merged 23 commits into from Aug 18, 2023

Conversation

darkmmon
Copy link
Contributor

PR Info

  • Closes
  • Dependencies:
  • Dependents:

New Features

Bug Fixes

Breaking Changes

Changes

  • add comprehensive test cases to most of the APIs

@tyt2y3
Copy link
Member

tyt2y3 commented Aug 15, 2023

As discussed, the most needed test cases are for:

  1. find_with_related()
  2. find_with_linked()

And we needed both unit testing e.g. https://github.com/SeaQL/sea-orm/blob/master/src/executor/paginator.rs#L299 https://github.com/SeaQL/sea-orm/blob/master/src/executor/cursor.rs#L308 and integration testing (which you are doing) to test the behaviour of consolidate_query_result.

tests/relational_tests.rs Outdated Show resolved Hide resolved
tests/relational_tests.rs Outdated Show resolved Hide resolved
src/query/join.rs Outdated Show resolved Hide resolved
src/query/join.rs Outdated Show resolved Hide resolved
src/query/join.rs Outdated Show resolved Hide resolved
tests/relational_tests.rs Outdated Show resolved Hide resolved
tests/loader_tests.rs Outdated Show resolved Hide resolved
src/executor/select.rs Outdated Show resolved Hide resolved
tests/relational_tests.rs Outdated Show resolved Hide resolved
src/executor/select.rs Outdated Show resolved Hide resolved
}

#[smol_potat::test]
pub async fn with_related() -> Result<(), sea_orm::DbErr> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add 1 more case: Cake -> Filling

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see new test cases for Cake -> Vendor but not Cake -> Filling?

src/executor/select.rs Outdated Show resolved Hide resolved
issues/1790/insert_test.rs Outdated Show resolved Hide resolved
@darkmmon darkmmon marked this pull request as ready for review August 18, 2023 11:03
Comment on lines +1327 to +1328
cake_fruit_model(1, 1).into_mock_row(),
cake_fruit_model(2, 1).into_mock_row(),
Copy link
Member

@tyt2y3 tyt2y3 Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't duplicate right? This should be for Filling?

.into_connection();

assert_eq!(
Cake::find().find_with_related(Fruit).all(&db).await?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, may be change this to Filling

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make the changes.

@tyt2y3 tyt2y3 merged commit d50312c into SeaQL:master Aug 18, 2023
31 of 32 checks passed
@github-actions
Copy link

🎉 Released In 0.12.3 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants