package com.cottondb.storyimport com.cottondb.shell.core.CottonCoreimport com.cottondb.story.ink.youOfimport kotlinx.serialization.json.JsonObjectimport kotlinx.serialization.json.jsonObjectimport org.junit.Assert.assertEqualsimport org.junit.Assert.assertNullimport org.junit.Test/** * Story's Settings names who signed in. Story keeps no person table, so on the emulator (launch-story walk, 22 Nov 2026) * it said "Account" with no number after a sign-in that asked "Your name": the name and number are the sign-in this * phone keeps. Every name and number here is invented. */classStoryYouTest {privatefun json(text: String): JsonObject = CottonCore.json.parseToJsonElement(text).jsonObjectprivateval held = json("""{"phone":"+15550190000","person":{"id":"p-1","phone":"+15550190000","name":"Asha Invented","role":"owner"},"credential":"x"}""") @Test fun with_no_person_row_the_kept_sign_in_names_you() {val linked = youOf(json("""{"owner":"linked","person_id":"p-1"}"""), row = null, held = held) assertEquals("Asha Invented", linked.name) assertEquals("+15550190000", linked.number)val notYet = youOf(json("""{"owner":"none_yet"}"""), row = null, held = held) assertEquals("Asha Invented", notYet.name) assertEquals("+15550190000", notYet.number) } @Test fun the_person_row_comes_first_and_signed_out_names_nobody() {val row = json("""{"full_name":"Asha Renamed","phones":["+15550191111"]}""")val you = youOf(json("""{"owner":"linked","person_id":"p-1"}"""), row, held) assertEquals("Asha Renamed", you.name) assertEquals("+15550191111", you.number)val out = youOf(json("""{"owner":"none_yet"}"""), row = null, held = null) assertNull(out.name) assertNull(out.number) }}