This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Kamila/remove handle #202
Merged
Merged
Kamila/remove handle #202
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5874fd9
Remove handle from the code.
kamilababayeva ffebc0a
remove handle from the tests
kamilababayeva 94d53d0
ScoreBoardActivityTest: remove the broken test
kamilababayeva 406d7a2
activity_create_profile: set the constraints
kamilababayeva 8e321c5
Update app/src/main/java/ch/sdp/vibester/model/UserSharedPref.kt
kamilababayeva 842e7a1
SearchUserActivity: add spaces
kamilababayeva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ class CreateProfileActivityTest { | |
val mockUsersRepo = mockk<UsersRepo>() | ||
|
||
private fun createMockInvocation(email: String) { | ||
every {mockUsersRepo.createUser(any(), any(), any(), any())} answers { | ||
every {mockUsersRepo.createUser(any(), any(), any())} answers { | ||
lastArg<(String) -> Unit>().invoke(email) | ||
} | ||
|
||
|
@@ -58,7 +58,6 @@ class CreateProfileActivityTest { | |
@Test | ||
fun createAccCorrect() { | ||
var username = "mockUsername" | ||
var handle = "mockHandle" | ||
var mockEmail = "[email protected]" | ||
|
||
val intent = Intent(ApplicationProvider.getApplicationContext(), CreateProfileActivity::class.java) | ||
|
@@ -71,9 +70,7 @@ class CreateProfileActivityTest { | |
onView(withId(R.id.accountUsername)).perform(ViewActions.typeText(username), | ||
ViewActions.closeSoftKeyboard() | ||
) | ||
onView(withId(R.id.accountHandle)).perform(ViewActions.typeText(handle), | ||
ViewActions.closeSoftKeyboard() | ||
) | ||
|
||
onView(withId(R.id.createButton)).perform(ViewActions.click()) | ||
|
||
Intents.intended(IntentMatchers.hasComponent(ProfileActivity::class.java.name)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,15 +55,14 @@ class ProfileActivityTest { | |
|
||
@Test | ||
fun checkProfileData() { | ||
val inputProfile = User("@lisa", "Lalisa Bon","bit.ly/3IUnyAF", "[email protected]", 12, 8, 29, 0) | ||
val inputProfile = User("Lalisa Bon","bit.ly/3IUnyAF", "[email protected]", 12, 8, 29, 0) | ||
val ctx = ApplicationProvider.getApplicationContext() as Context | ||
val intent = Intent(ctx, ProfileActivity::class.java) | ||
|
||
createMockInvocation(inputProfile) | ||
UserSharedPref.setUser(ctx, inputProfile, false) | ||
val scn: ActivityScenario<ProfileActivity> = ActivityScenario.launch(intent) | ||
|
||
onView(withId(R.id.handle)).check(matches(withText(inputProfile.handle))) | ||
onView(withId(R.id.username)).check(matches(withText(inputProfile.username))) | ||
onView(withId(R.id.correctSongs)).check(matches(withText(inputProfile.correctSongs.toString()))) | ||
onView(withId(R.id.totalGames)).check(matches(withText(inputProfile.totalGames.toString()))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ class UserSharedPrefTest { | |
val mailTest = "[email protected]" | ||
UserSharedPref.userReset(ctx, mailTest) | ||
UserSharedPref.updateUsername(ctx, "Lalisa Bon") | ||
UserSharedPref.updateHandle(ctx, "@lisa") | ||
UserSharedPref.updateScore(ctx) | ||
Thread.sleep(1000) | ||
// assertEquals(mailTest, UserSharedPref.getUser(ctx).email) //TODO temporary disable does not pass on CI | ||
|
@@ -23,7 +22,6 @@ class UserSharedPrefTest { | |
@Test | ||
fun sharedPrefTest2(){ | ||
val ctx = ApplicationProvider.getApplicationContext() as Context | ||
val handle: String = "myHandle" | ||
val username: String = "myUsername" | ||
val image: String = "myImage" | ||
val email: String = "myEmail" | ||
|
@@ -32,13 +30,12 @@ class UserSharedPrefTest { | |
val correctSongs: Int = 16 | ||
val ranking: Int = 6 | ||
|
||
val pro = User(handle, username, image, email, totalGames, bestScore, correctSongs, ranking) | ||
val pro = User(username, image, email, totalGames, bestScore, correctSongs, ranking) | ||
UserSharedPref.setUser(ctx, pro, false) | ||
UserSharedPref.updateScore(ctx, 1, -1, 0, 1) | ||
Thread.sleep(1000) | ||
val updated = UserSharedPref.getUser(ctx) | ||
|
||
assertEquals(pro.handle, updated.handle) | ||
assertEquals(pro.username, updated.username) | ||
assertEquals(pro.image, updated.image) | ||
assertEquals(pro.email, updated.email) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ class UserProfileAdapterTest { | |
|
||
@Test | ||
fun recyclerViewShowsCorrectCount() { | ||
val user1 = User("test1", "Brownie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "Cookie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user1 = User("test1", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val users: MutableList<User> = arrayListOf() | ||
users.addAll(listOf(user1, user2)) | ||
val userProfileViewHolder: RecyclerView.Adapter<UserProfileAdapter.UserProfileViewHolder> = UserProfileAdapter(users) | ||
|
@@ -21,8 +21,8 @@ class UserProfileAdapterTest { | |
|
||
@Test | ||
fun itemTypeIsCorrect() { | ||
val user1 = User("test1", "Brownie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "Cookie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user1 = User("test1", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val users: MutableList<User> = arrayListOf() | ||
users.addAll(listOf(user1, user2)) | ||
val userProfileViewHolder: RecyclerView.Adapter<UserProfileAdapter.UserProfileViewHolder> = UserProfileAdapter(users) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ import org.junit.Test | |
class UserScoreboardAdapterTest { | ||
@Test | ||
fun recyclerViewShowsCorrectCount() { | ||
val user1 = User("test1", "Brownie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "Cookie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user1 = User("test1","https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2","https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val players: MutableList<User> = arrayListOf() | ||
players.addAll(listOf(user1, user2)) | ||
val userScoreboardViewHolder: RecyclerView.Adapter<UserScoreboardAdapter.PlayerViewHolder> = | ||
|
@@ -24,8 +24,8 @@ class UserScoreboardAdapterTest { | |
|
||
@Test | ||
fun itemTypeIsCorrect() { | ||
val user1 = User("test1", "Brownie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "Cookie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user1 = User("test1", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val players: MutableList<User> = arrayListOf() | ||
players.addAll(listOf(user1, user2)) | ||
val userScoreboardViewHolder: RecyclerView.Adapter<UserScoreboardAdapter.PlayerViewHolder> = | ||
|
@@ -36,8 +36,8 @@ class UserScoreboardAdapterTest { | |
|
||
@Test | ||
fun setupAdapterForRecyclerView() { | ||
val user1 = User("test1", "Brownie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "Cookie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user1 = User("test1", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val players: MutableList<User> = arrayListOf() | ||
players.addAll(listOf(user1, user2)) | ||
val recyclerView = RecyclerView(ApplicationProvider.getApplicationContext()) | ||
|
@@ -46,22 +46,22 @@ class UserScoreboardAdapterTest { | |
val playerAdapter = UserScoreboardAdapter(players) | ||
recyclerView.adapter = playerAdapter | ||
val newPlayers: MutableList<User> = arrayListOf() | ||
newPlayers.add(User("test3", "Scone", "https://images.app.goo.gl/YkBi16zwyjB7ejj96", "[email protected]")) | ||
newPlayers.add(User("test3","https://images.app.goo.gl/YkBi16zwyjB7ejj96", "[email protected]")) | ||
playerAdapter.addPlayers(newPlayers) | ||
playerAdapter.notifyDataSetChanged() | ||
} | ||
|
||
@Test | ||
fun addPlayersWorks() { | ||
val user1 = User("test1", "Brownie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "Cookie", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user1 = User("test1", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val user2 = User("test2", "https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", "[email protected]") | ||
val players: MutableList<User> = arrayListOf() | ||
players.addAll(listOf(user1, user2)) | ||
val recyclerView = RecyclerView(ApplicationProvider.getApplicationContext()) | ||
recyclerView.layoutManager = | ||
LinearLayoutManager(ApplicationProvider.getApplicationContext()) | ||
val playerAdapter = UserScoreboardAdapter(players) | ||
val player3 = User("test3", "Scone", "https://images.app.goo.gl/YkBi16zwyjB7ejj96", "[email protected]") | ||
val player3 = User("test3","https://images.app.goo.gl/YkBi16zwyjB7ejj96", "[email protected]") | ||
val updatedList = arrayListOf(player3) | ||
playerAdapter.addPlayers(updatedList) | ||
assertThat(playerAdapter.players == updatedList, equalTo(true)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this test is removed? Does it relate to handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the users in the firebase is not deterministic. We have been deleting/adding users, so the user positions always change. I believe the removal of the test will not decrease any coverage of your changes