From 7395de0b32126d0c7fc30e0fa0375cae6d94e94c Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Tue, 10 Sep 2024 09:01:46 -0400 Subject: [PATCH] Removed unnecessary tests --- .../sharedlogin/JetpackPublicDataTest.kt | 23 ----- .../sharedlogin/WordPressPublicDataTest.kt | 92 ------------------- 2 files changed, 115 deletions(-) delete mode 100644 WordPress/src/test/java/org/wordpress/android/sharedlogin/JetpackPublicDataTest.kt delete mode 100644 WordPress/src/test/java/org/wordpress/android/sharedlogin/WordPressPublicDataTest.kt diff --git a/WordPress/src/test/java/org/wordpress/android/sharedlogin/JetpackPublicDataTest.kt b/WordPress/src/test/java/org/wordpress/android/sharedlogin/JetpackPublicDataTest.kt deleted file mode 100644 index d5c3f13a72f4..000000000000 --- a/WordPress/src/test/java/org/wordpress/android/sharedlogin/JetpackPublicDataTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.wordpress.android.sharedlogin - -import org.assertj.core.api.Assertions.assertThat -import org.junit.Test -import org.wordpress.android.util.publicdata.JetpackPublicData - -class JetpackPublicDataTest { - private val classToTest = JetpackPublicData() - - @Test - fun `Should return correct release public hash key`() { - val actual = classToTest.currentPublicKeyHash() - val expected = "f2d7acc12614750009514a0932bf0b0aa9c11829a66e862ce4572bced344e76e" - assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Should return correct current package ID`() { - val actual = classToTest.currentPackageId() - val expected = "com.jetpack.android" - assertThat(actual).isEqualTo(expected) - } -} diff --git a/WordPress/src/test/java/org/wordpress/android/sharedlogin/WordPressPublicDataTest.kt b/WordPress/src/test/java/org/wordpress/android/sharedlogin/WordPressPublicDataTest.kt deleted file mode 100644 index 58a3ef52b221..000000000000 --- a/WordPress/src/test/java/org/wordpress/android/sharedlogin/WordPressPublicDataTest.kt +++ /dev/null @@ -1,92 +0,0 @@ -package org.wordpress.android.sharedlogin - -import android.content.pm.PackageInfo -import org.assertj.core.api.Assertions -import org.junit.Test -import org.mockito.kotlin.any -import org.mockito.kotlin.mock -import org.mockito.kotlin.whenever -import org.wordpress.android.util.publicdata.PackageManagerWrapper -import org.wordpress.android.util.publicdata.WordPressPublicData - -class WordPressPublicDataTest { - private val packageManagerWrapper: PackageManagerWrapper = mock() - - private val classToTest = WordPressPublicData(packageManagerWrapper) - - @Test - fun `Should return correct current package ID`() { - val actual = classToTest.currentPackageId() - val expected = "org.wordpress.android" - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Should return correct current package version`() { - mockVersion("21.2-rc-3") - val actual = classToTest.currentPackageVersion() - val expected = "21.2-rc-3" - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Versions without semantic information should be equal to the non semantic version`() { - mockVersion("21.2") - val actual = classToTest.nonSemanticPackageVersion() - val expected = "21.2" - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Release candidate versions should be stripped from the non semantic version`() { - mockVersion("21.2-rc-3") - val actual = classToTest.nonSemanticPackageVersion() - val expected = "21.2" - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Alpha versions should be stripped from the non semantic version`() { - mockVersion("21.2-alpha-3") - val actual = classToTest.nonSemanticPackageVersion() - val expected = "21.2" - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Invalid versions should return a null non semantic version`() { - mockVersion("21.a2...-rc2") - val actual = classToTest.nonSemanticPackageVersion() - val expected = null - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Empty versions should return a null non semantic version`() { - mockVersion("") - val actual = classToTest.nonSemanticPackageVersion() - val expected = null - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `Only the major-minor version information is returned`() { - mockVersion("21.3.1") - val actual = classToTest.nonSemanticPackageVersion() - val expected = "21.3" - Assertions.assertThat(actual).isEqualTo(expected) - } - - @Test - fun `When only the major is provided a null non semantic version is returned`() { - mockVersion("21") - val actual = classToTest.nonSemanticPackageVersion() - val expected = null - Assertions.assertThat(actual).isEqualTo(expected) - } - - private fun mockVersion(version: String) { - val packageInfo = PackageInfo().apply { versionName = version } - whenever(packageManagerWrapper.getPackageInfo(any(), any())).thenReturn(packageInfo) - } -}