package com.peachpasswords.ui.vault import com.peachpasswords.vault.VaultEntry import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test class EntryDetailParityTest { @Test fun entry_homograph_warning_checks_primary_and_additional_urls() { val safe = VaultEntry( id = "1", title = "Safe", url = "https://example.com", additionalUrls = listOf("https://accounts.example.com"), createdAt = 1, modifiedAt = 1, ) val risky = safe.copy(additionalUrls = listOf("https://xn--pple-43d.com")) assertFalse(entryHasHomographWarning(safe)) assertTrue(entryHasHomographWarning(risky)) } @Test fun short_credential_preserves_readable_edges() { assertEquals("short", shortCredential("short")) assertEquals("abcdef...7890", shortCredential("abcdefghijklmnopqrstuvwxyz7890")) } @Test fun canary_status_label_handles_count_without_date() { assertEquals("0 total alerts", canaryStatusLabel(null, null)) assertEquals("1 total alert", canaryStatusLabel(null, 1)) } @Test fun canary_webhook_validation_matches_browser_public_https_rule() { assertTrue(isAllowedCanaryWebhookUrl("https://hooks.example.com/peach")) assertFalse(isAllowedCanaryWebhookUrl("http://hooks.example.com/peach")) assertFalse(isAllowedCanaryWebhookUrl("https://localhost/peach")) assertFalse(isAllowedCanaryWebhookUrl("https://127.0.0.1/peach")) assertFalse(isAllowedCanaryWebhookUrl("https://192.168.1.50/peach")) assertFalse(isAllowedCanaryWebhookUrl("not a url")) } }