-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for easily finding duplicates (#355)
* Add support for easily finding duplicate definitions accross modules via a unit test in the app. * Fix linting errors * Delete unused import * Creating and using duplicatedDeepLinkEntries and allDeepLinkEntries as toplevel functions for better extensibility Co-authored-by: Andreas Rossbacher <[email protected]>
- Loading branch information
1 parent
64ecbf3
commit 5a14e69
Showing
5 changed files
with
156 additions
and
37 deletions.
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
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
43 changes: 43 additions & 0 deletions
43
sample/src/test/java/com/airbnb/deeplinkdispatch/sample/AppDeepLinkDelegateTest.kt
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.airbnb.deeplinkdispatch.sample | ||
|
||
import com.airbnb.deeplinkdispatch.sample.benchmarkable.BenchmarkDeepLinkModuleRegistry | ||
import com.airbnb.deeplinkdispatch.sample.kaptlibrary.KaptLibraryDeepLinkModuleRegistry | ||
import com.airbnb.deeplinkdispatch.sample.library.LibraryDeepLinkModuleRegistry | ||
import org.hamcrest.MatcherAssert | ||
import org.hamcrest.core.Is | ||
import org.hamcrest.core.IsEqual | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
import org.robolectric.annotation.Config | ||
|
||
@Config(sdk = [21], manifest = "../sample/src/main/AndroidManifest.xml") | ||
@RunWith(RobolectricTestRunner::class) | ||
class AppDeepLinkDelegateTest { | ||
|
||
// Demo test to find duplicate URLs across all modules | ||
@Test | ||
fun testDuplicatedEntries() { | ||
val configurablePlaceholdersMap = mapOf( | ||
"configPathOne" to "somePathThree", | ||
"configurable-path-segment-one" to "", | ||
"configurable-path-segment" to "", | ||
"configurable-path-segment-two" to "", | ||
"configPathOne" to "somePathOne" | ||
) | ||
val deepLinkDelegate = DeepLinkDelegate( | ||
SampleModuleRegistry(), | ||
LibraryDeepLinkModuleRegistry(), | ||
BenchmarkDeepLinkModuleRegistry(), | ||
KaptLibraryDeepLinkModuleRegistry(), | ||
configurablePlaceholdersMap | ||
) | ||
MatcherAssert.assertThat( | ||
deepLinkDelegate.duplicatedDeepLinkEntries.size, | ||
IsEqual.equalTo(3) | ||
) | ||
MatcherAssert.assertThat(deepLinkDelegate.allDeepLinkEntries.any { it.uriTemplate == "dld://host/intent/{abc}" }, Is.`is`(true)) | ||
MatcherAssert.assertThat(deepLinkDelegate.allDeepLinkEntries.any { it.uriTemplate == "dld://host/intent/{def}" }, Is.`is`(true)) | ||
MatcherAssert.assertThat(deepLinkDelegate.allDeepLinkEntries.any { it.uriTemplate == "dld://host/intent/{geh}" }, Is.`is`(true)) | ||
} | ||
} |