package com.peachpasswords.sync import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test /** * §18.4: a corrupt persisted ledger must not be read as empty — that would * silently un-revoke every device. The corrupt payload must throw a * [TrustDataCorruptedException] whose message classifies as * [SyncOutcomeReason.TRUST_DATA_CORRUPTED]. */ class TrustDataCorruptedTest { @Test fun `TrustDataCorruptedException message is classified as TRUST_DATA_CORRUPTED`() { val exc = TrustDataCorruptedException("paired_devices", "decode_failed") assertEquals( SyncOutcomeReason.TRUST_DATA_CORRUPTED, classifySyncError(exc.message!!), ) } @Test fun `TrustDataCorruptedException is a failure outcome`() { assertTrue(SyncOutcomeReason.TRUST_DATA_CORRUPTED.isFailure) } @Test fun `TrustDataCorruptedException is not a warning outcome`() { assertEquals(false, SyncOutcomeReason.TRUST_DATA_CORRUPTED.isWarning) } }