Skip to content

Commit

Permalink
fix test by mocking missing property
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 17, 2024
1 parent 40926b8 commit 1caf522
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/test/kotlin/app/revanced/patcher/PatcherTest.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.revanced.patcher

import app.revanced.patcher.patch.BytecodePatchContext.MethodLookupMaps
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.ResourcePatchContext
Expand Down Expand Up @@ -39,7 +40,7 @@ internal object PatcherTest {

every { context.bytecodeContext.classes } returns mockk(relaxed = true)
every { context.bytecodeContext.integrations } returns mockk(relaxed = true)
every { apply(false) } answers { callOriginal() }
every { execute() } answers { callOriginal() }
}
}

Expand Down Expand Up @@ -100,7 +101,7 @@ internal object PatcherTest {
fun `matches fingerprint`() {
mockClassWithMethod()

val patches = setOf(bytecodePatch { fingerprint { this returns "V" }() })
val patches = setOf(bytecodePatch { fingerprint { this returns "V" } })

assertNull(
patches.first().fingerprints.first().match,
Expand All @@ -120,7 +121,7 @@ internal object PatcherTest {
private operator fun Set<Patch<*>>.invoke(): List<PatchResult> {
every { patcher.context.executablePatches } returns toMutableSet()

return runBlocking { patcher.apply(false).toList() }
return runBlocking { patcher.execute().toList() }
}

private operator fun Patch<*>.invoke() = setOf(this)().first()
Expand Down Expand Up @@ -158,5 +159,6 @@ internal object PatcherTest {
),
),
)
every { patcher.context.bytecodeContext.methodLookupMaps } returns MethodLookupMaps(patcher.context.bytecodeContext.classes)
}
}

0 comments on commit 1caf522

Please sign in to comment.