Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Laurislopata/mock db refactor #151

Merged
merged 12 commits into from
Apr 6, 2022
Merged

Conversation

laurislopata
Copy link
Collaborator

No description provided.

@laurislopata laurislopata marked this pull request as ready for review April 6, 2022 14:14
@laurislopata
Copy link
Collaborator Author

So in this PR, I refactored authentication and user profile tests to use mock data. for this, I set up Hilt an automatic dependency injector and mockk a mocking library for Kotlin. The test coverage is a bit low because we're now using mock data instead of connecting to the actual database.

app/build.gradle Outdated Show resolved Hide resolved
app/build.gradle Outdated Show resolved Hide resolved
Copy link
Collaborator

@Tsathogguaa Tsathogguaa left a comment

Choose a reason for hiding this comment

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

Once you remove the unnecessary commented code, will approve. Great work otherwise!

@laurislopata
Copy link
Collaborator Author

laurislopata commented Apr 6, 2022

Deleted unnecessary code

Copy link
Collaborator

@Tsathogguaa Tsathogguaa left a comment

Choose a reason for hiding this comment

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

Good cleanup and good work!

Copy link
Owner

@MaximeZmt MaximeZmt left a comment

Choose a reason for hiding this comment

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

👍 nice improvement for the codebase

@codeclimate
Copy link

codeclimate bot commented Apr 6, 2022

Code Climate has analyzed commit 551cfad and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 67.7% (80% is the threshold).

This pull request will bring the total coverage in the repository to 92.4%.

View more on Code Climate.

@laurislopata laurislopata merged commit 0b21685 into main Apr 6, 2022
@laurislopata laurislopata deleted the laurislopata/MockDB-refactor branch April 6, 2022 14:48


Copy link
Collaborator

Choose a reason for hiding this comment

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

It will be great if you can add some documentation to this class and its non-trivial functions

.child(name)
.setValue(input.text.toString())
})
usersRepo.updateField("-Myfy9TlCUTWYRxVLBsQ", input.text.toString() ,name)
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
usersRepo.updateField("-Myfy9TlCUTWYRxVLBsQ", input.text.toString() ,name)
usersRepo.updateField("-Myfy9TlCUTWYRxVLBsQ", input.text.toString(), name)

@@ -29,11 +44,42 @@ import kotlin.random.Random
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
@HiltAndroidTest
class AuthenticationActivityTest {
private val sleepTime: Long = 5000
Copy link
Collaborator

Choose a reason for hiding this comment

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

sleepTime can be deleted if it's no longer used

import org.junit.Test
import org.junit.runner.RunWith


@RunWith(AndroidJUnit4::class)
@HiltAndroidTest
class ProfileActivityTest {

private val sleepTime: Long = 4000
Copy link
Collaborator

Choose a reason for hiding this comment

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

same for this

class ProfileActivityTest {

private val sleepTime: Long = 4000

@get:Rule(order = 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need the order = 0 if it's the only rule?

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

Successfully merging this pull request may close these issues.

4 participants