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

Refactor tests #251

Merged
merged 4 commits into from
Feb 6, 2025
Merged

Refactor tests #251

merged 4 commits into from
Feb 6, 2025

Conversation

Kaaveh
Copy link
Owner

@Kaaveh Kaaveh commented Feb 6, 2025

Refactor existing tests in data:market-repository module.

close #250

- Added comprehensive tests for `toMarket` and `toRemoteMarketDto` mappers, covering valid, empty, extreme, and negative value scenarios.
- Updated `kotest` to version `6.0.0.M1`.
- Implement detailed test cases in `MarketEntityMapperTest` to cover various scenarios.
- Add test cases for empty strings, zero values, extreme double values, and negative values.
- Add test cases for handling `isFavorite` as both true and false.
- Improve the equality checks in the tests.
- Refactor existing test cases to use shouldBe instead of shouldBeEqual.
- remove unnecessary imports.
@Kaaveh Kaaveh added the refactor label Feb 6, 2025
@Kaaveh Kaaveh requested a review from VahidGarousi February 6, 2025 11:50
@Kaaveh Kaaveh self-assigned this Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

1 Message
📖 Thanks @Kaaveh!

Generated by 🚫 Danger


val market = marketResponse.toMarket()

market shouldBeEqual marketResponse
Copy link
Collaborator

@VahidGarousi VahidGarousi Feb 6, 2025

Choose a reason for hiding this comment

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

Suggested change
market shouldBeEqual marketResponse
MarketResponse(
id = "extreme",
name = "Extreme Market",
symbol = "ext",
currentPrice = Double.MAX_VALUE,
priceChangePercentage24h = Double.MIN_VALUE,
imageUrl = "https://image.url/extreme.png",
).toMarket() shouldBeEqual marketResponse


val market = marketEntity.toMarket()

market shouldBeEqual marketEntity
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
market shouldBeEqual marketEntity
MarketEntity(
id = "bitcoin",
name = "Bitcoin",
symbol = "btc",
currentPrice = 20000.0,
priceChangePercentage24h = 2.0,
imageUrl = "https://image.url/bitcoin.png",
isFavorite = FALSE,
).toMarket() shouldBeEqual marketEntity

Copy link
Collaborator

@VahidGarousi VahidGarousi left a comment

Choose a reason for hiding this comment

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

Don't add unnecessary variables as much as possible.
I commented on some of those, we should fix all of them

@Kaaveh Kaaveh merged commit 6145541 into kmp Feb 6, 2025
3 checks passed
@Kaaveh Kaaveh deleted the refactor/tests branch February 6, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor all tests in code base
2 participants