fix(test): use precise InvalidDataException assertion in wrong-key encryption test

Code quality review feedback: Should.Throw<Exception> was too broad,
changed to Should.Throw<InvalidDataException> to match the actual
exception type thrown when AEAD decryption fails with wrong key.
This commit is contained in:
Joseph Doherty
2026-02-25 00:51:37 -05:00
parent f143295392
commit 10e2c4ef22

View File

@@ -92,13 +92,13 @@ public class FileStoreEncryptionTests
await store.AppendAsync("secret", "data"u8.ToArray(), default);
}
// Recovery with wrong key should throw or return no messages
// Recovery with wrong key should throw InvalidDataException (from CryptographicException)
var act = () => new FileStore(new FileStoreOptions
{
Directory = dir.FullName,
Cipher = StoreCipher.ChaCha,
EncryptionKey = key2,
});
Should.Throw<Exception>(act);
Should.Throw<InvalidDataException>(act);
}
}