From f6a28aa22620ddd9b772e64860087754832d5f24 Mon Sep 17 00:00:00 2001 From: EETagent Date: Thu, 17 Nov 2022 12:42:20 +0100 Subject: [PATCH] feat: include custom errors in test coverage --- core/src/error.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/error.rs b/core/src/error.rs index 4c8f4f1..206d579 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -94,3 +94,17 @@ impl ServiceError { } } } + +#[cfg(test)] +mod tests { + use super::ServiceError; + + #[test] + fn test_service_error_code() { + let error = ServiceError::CryptoHashFailed; + + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status + assert!(error.code() >= 100); + assert!(error.code() <= 599); + } +} \ No newline at end of file