Test: page 1000 against the Arcade's real save (from the p1000 merge check, 8916580)

Unlocks only for a saved storyComplete=true; locked for a false flag, an
unreadable file, no file, and before ArcadeProgress is set up. Test only:
the app is unchanged from the installed 0.110.12-story-p1000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 23:28:39 +00:00
co-authored by Claude Opus 5.5
parent c74c1a763a
commit 835dea5cf8
@@ -0,0 +1,31 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import tv.orbit.classic.arcade.ArcadeStore
/** Page 1000 against the Arcade's real save: a profile that finished Orbi-Raiders' Story unlocks it, and only that profile. */
class OrbiFaxArcadeUnlockTest {
@get:Rule val temp = TemporaryFolder()
@Test fun aSaveWithStoryCompleteUnlocksPage1000ForThatProfileOnly() {
ArcadeStore(temp.root).update("a") { d ->
d.withGame("OrbiRaiders") { it.copy(level = it.level + ArcadeProgress.storyCompleteValues(1_000, tv.orbit.classic.arcade.Difficulty.entries.first())) }
}
ArcadeStore(temp.root).update("b") { d -> d.withGame("OrbiRaiders") { it.copy(level = it.level + ("storyComplete" to "false")) } }
ArcadeStore(temp.root).file("c").writeText("{ not json")
val store = ArcadeStore(temp.root) // a fresh read, as after a restart
val progress = StoryProgress { ArcadeProgress.storyComplete(store.load(it)) }
fun grown(id: String) = Profile(id, id, "ollie", ProfileKind.Grown)
assertTrue(orbiFaxSecret(grown("a"), progress))
assertFalse(orbiFaxSecret(grown("b"), progress)) // flag there but false
assertFalse(orbiFaxSecret(grown("c"), progress)) // a file that won't parse
assertFalse(orbiFaxSecret(grown("d"), progress)) // no file at all
assertFalse(ArcadeProgress.isStoryComplete("a")) // before Orbit is ready (not initialised), always locked
val book = OrbiFaxPages(OrbiFaxData(emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), kids = false, secret = orbiFaxSecret(grown("a"), progress)))
assertEquals(ORBI_FAX_SECRET_PAGE, OrbiFaxNav(secret = true).digit(1).digit(0).digit(0).digit(0).page)
assertTrue(book.data.secret)
}
}