Cotton code
30 lines · 1.4 KB · KotlinRaw
package com.cottondb.storyimport org.junit.Assert.assertEqualsimport org.junit.Assert.assertTrueimport org.junit.Testimport java.io.File/** * Story has no fan, so the shell's `account` (filled only while a fan stands on its Account card) is always empty in * Story: Settings read it and showed, signed out, an empty face and no Sign in or Back up (the emulator, 21 Nov 2026). * Story asks the core's `shell.account` itself; this holds that no Story source reads the shell's field again. */class StoryAccountGuardTest {    private fun storySources(): List<File> {        val roots = listOf("src/story/kotlin", "app/src/story/kotlin").map(::File).filter { it.isDirectory }        return roots.flatMap { root -> root.walkTopDown().filter { it.isFile && it.extension == "kt" }.toList() }    }    @Test fun no_story_source_reads_the_shells_account() {        val sources = storySources()        assertTrue("Story's sources were not found from ${File(".").absolutePath}", sources.isNotEmpty())        val readers = sources.filter { Regex("""(?<!")\bshell\.account\b(?!")""").containsMatchIn(it.readText()) }.map { it.name }        assertEquals("Story reads shell.account, empty without a fan", emptyList<String>(), readers)    }    @Test fun settings_asks_the_core_for_the_account() {        val pages = storySources().first { it.name == "Pages.kt" }.readText()        assertTrue(pages.contains("core.obj(\"shell.account\")"))    }}