package com.cottondb.story import com.cottondb.shell.core.Lines import com.cottondb.story.ink.dayOf import org.junit.Assert.assertEquals import org.junit.Test import java.time.LocalDate /** * A draft's date is said in the core's own date words ("25 Nov"), as Cotton says every date. On an American phone it * stood as "Nov 25, 2026" beside the app's "25 Nov" elsewhere (first-run walk, 25 Nov 2026). */ class StoryDraftDateTest { private val lines = Lines( mapOf( "dates.months.nov" to "Nov", "dates.months.jan" to "Jan", "dates.day_month.this_year" to "{date} {month}", "dates.day_month.other_year" to "{date} {month} {year}", ), "Story", ) @Test fun a_draft_of_this_year_says_the_day_and_month() { val noon = java.time.ZonedDateTime.of(2026, 11, 25, 12, 0, 0, 0, java.time.ZoneId.systemDefault()).toOffsetDateTime().toString() assertEquals("25 Nov", dayOf(noon, lines, today = LocalDate.of(2026, 11, 25))) } @Test fun a_draft_of_another_year_says_the_year_too() { val noon = java.time.ZonedDateTime.of(2025, 1, 3, 12, 0, 0, 0, java.time.ZoneId.systemDefault()).toOffsetDateTime().toString() assertEquals("3 Jan 2025", dayOf(noon, lines, today = LocalDate.of(2026, 11, 25))) } @Test fun no_date_says_nothing() { assertEquals(null, dayOf(null, lines)) } }