package com.aletheia.app.diagnostics

import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test

class DiagnosticsReportFormatterTest {

    @Test
    fun build_omitsExceptionMessagesAndUserDataFragments() {
        val error = IllegalStateException(
            "secret book text /storage/emulated/0/Books/private.fb2 https://qbooks.example password=123"
        )

        val report = DiagnosticsReportFormatter.build(
            DiagnosticsReportInput(
                createdAt = 0L,
                kind = "reader",
                threadName = "main",
                appVersion = "1.0 (1)",
                androidSdk = 36,
                error = error
            )
        )

        assertTrue(report.contains("Error: java.lang.IllegalStateException"))
        assertFalse(report.contains("secret book text"))
        assertFalse(report.contains("/storage/emulated/0"))
        assertFalse(report.contains("https://qbooks.example"))
        assertFalse(report.contains("password=123"))
    }
}
