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

Frontend - add unit tests #8

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.harmonyhub.components

import com.example.harmonyhub.ui.components.Friend
import com.example.harmonyhub.ui.components.contains
import org.junit.Assert.assertEquals
import org.junit.Test

class FriendCardTest {
@Test
fun testContains() {
val friend = Friend("nalgnaohel", "[email protected]", 2)
assertEquals(friend.contains("nalgnaohel"), true)
}

@Test
fun testNoContains() {
val friend = Friend("nalgnaohel", "[email protected]", 2)
assertEquals(friend.contains("Penta"), false)
}

@Test
fun testIgnoreCaseFalse() {
val friend = Friend("nalgnaohel", "[email protected]", 2)
assertEquals(friend.contains("nALgnaohel", ignoreCase = false), false)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.harmonyhub.components

import com.example.harmonyhub.ui.components.Playlist
import com.example.harmonyhub.ui.components.contains
import org.junit.Assert.assertEquals
import org.junit.Test

class PlaylistCardTest {
@Test
fun testContains() {
// Test the PlaylistCard
var playlist = Playlist("Mood In Mind", 1);
assertEquals(playlist.contains("Mood"), true);
}

@Test
fun testNoContains() {
// Test the PlaylistCard
var playlist = Playlist("Mood In Mind", 1);
assertEquals(playlist.contains("Penta"), false);
}

@Test
fun testIgnoreCaseFalse() {
// Test the PlaylistCard
var playlist = Playlist("Mood In Mind", 1);
assertEquals(false, playlist.contains("mood", ignoreCase = false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ class SongCardTest {
var song = Song("1", "Conditionally", "Katy Perry", "imageResId", "url");
assertEquals(song.contains("Taylor"), false);
}

@Test
fun testIgnoreCaseFalse() {
// Test the SongCard
var song = Song("1", "Conditionally", "Katy Perry", "imageResId", "url");
assertEquals(false, song.contains("perry", ignoreCase = false));
}
}
Loading