Загрузка данных


@Test
fun note_card_displays_summary_with_type_prefix_T() {
    composeRule.setContent {
        NotesAppTheme {
            NoteCard(note = note(content = "текст", type = NoteType.Text), onClick = {})
        }
    }
    composeRule.onAllNodesWithText("[T]", substring = true)
        .onFirst()
        .assertExists()
}

@Test
fun note_card_displays_summary_with_type_prefix_I() {
    composeRule.setContent {
        NotesAppTheme {
            NoteCard(note = note(content = "картинка", type = NoteType.Image), onClick = {})
        }
    }
    composeRule.onAllNodesWithText("[I]", substring = true)
        .onFirst()
        .assertExists()
}

@Test
fun note_card_displays_summary_with_type_prefix_A() {
    composeRule.setContent {
        NotesAppTheme {
            NoteCard(note = note(content = "аудио", type = NoteType.Audio), onClick = {})
        }
    }
    composeRule.onAllNodesWithText("[A]", substring = true)
        .onFirst()
        .assertExists()
}

@Test
fun note_card_long_summary_truncated_with_ellipsis() {
    val content = "a".repeat(100)
    composeRule.setContent {
        NotesAppTheme {
            NoteCard(note = note(content = content), onClick = {})
        }
    }
    // Проверяем, что начало длинного текста есть в дереве (обрезается визуально, но семантика сохраняется)
    composeRule.onAllNodesWithText("aaa", substring = true)
        .onFirst()
        .assertExists()
}