Skip to content

Commit

Permalink
style: remove code comments
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo Inacio <[email protected]>
  • Loading branch information
gusinacio committed Dec 28, 2023
1 parent 49e0790 commit 4692d8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 74 deletions.
28 changes: 0 additions & 28 deletions tap_core/src/adapters/mock/auditor_executor_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,6 @@ use std::{
};
use tokio::sync::RwLock;

/// `RAVStorageAdapterMock` is a mock implementation of the `RAVStorageAdapter` trait.
///
/// It serves two main purposes:
///
/// 1. **Unit Testing**: The `RAVStorageAdapterMock` is primarily intended to be used for unit tests,
/// providing a way to simulate the behavior of a real `RAVStorageAdapter` without requiring a real
/// implementation. By using a mock implementation, you can create predictable behaviors and
/// responses, enabling isolated and focused testing of the logic that depends on the `RAVStorageAdapter` trait.
///
/// 2. **Example Implementation**: New users of the `RAVStorageAdapter` trait can look to
/// `RAVStorageAdapterMock` as a basic example of how to implement the trait.
///
/// Note: This mock implementation is not suitable for production use. Its methods simply manipulate a
/// local `RwLock<Option<SignedRAV>>`, and it provides no real error handling.
///
/// # Usage
///
/// To use `RAVStorageAdapterMock`, first create an `Arc<RwLock<Option<SignedRAV>>>`, then pass it to
/// `RAVStorageAdapterMock::new()`. Now, it can be used anywhere a `RAVStorageAdapter` is required.
///
/// ```rust
/// use std::sync::{Arc};
/// use tokio::sync::RwLock;
/// use tap_core::{tap_manager::SignedRAV, adapters::rav_storage_adapter_mock::RAVStorageAdapterMock};
///
/// let rav_storage: Arc<RwLock<Option<SignedRAV>>> = Arc::new(RwLock::new(None));
/// let adapter = RAVStorageAdapterMock::new(rav_storage);
/// ```
#[derive(Clone)]
pub struct AuditorExecutorMock {
receipt_storage: Arc<RwLock<HashMap<u64, ReceivedReceipt>>>,
Expand Down
28 changes: 0 additions & 28 deletions tap_core/src/adapters/mock/executor_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,6 @@ use tokio::sync::RwLock;
pub type EscrowStorage = Arc<RwLock<HashMap<Address, u128>>>;
pub type QueryAppraisals = Arc<RwLock<HashMap<u64, u128>>>;

/// `RAVStorageAdapterMock` is a mock implementation of the `RAVStorageAdapter` trait.
///
/// It serves two main purposes:
///
/// 1. **Unit Testing**: The `RAVStorageAdapterMock` is primarily intended to be used for unit tests,
/// providing a way to simulate the behavior of a real `RAVStorageAdapter` without requiring a real
/// implementation. By using a mock implementation, you can create predictable behaviors and
/// responses, enabling isolated and focused testing of the logic that depends on the `RAVStorageAdapter` trait.
///
/// 2. **Example Implementation**: New users of the `RAVStorageAdapter` trait can look to
/// `RAVStorageAdapterMock` as a basic example of how to implement the trait.
///
/// Note: This mock implementation is not suitable for production use. Its methods simply manipulate a
/// local `RwLock<Option<SignedRAV>>`, and it provides no real error handling.
///
/// # Usage
///
/// To use `RAVStorageAdapterMock`, first create an `Arc<RwLock<Option<SignedRAV>>>`, then pass it to
/// `RAVStorageAdapterMock::new()`. Now, it can be used anywhere a `RAVStorageAdapter` is required.
///
/// ```rust
/// use std::sync::{Arc};
/// use tokio::sync::RwLock;
/// use tap_core::{tap_manager::SignedRAV, adapters::rav_storage_adapter_mock::RAVStorageAdapterMock};
///
/// let rav_storage: Arc<RwLock<Option<SignedRAV>>> = Arc::new(RwLock::new(None));
/// let adapter = RAVStorageAdapterMock::new(rav_storage);
/// ```
#[derive(Clone)]
pub struct ExecutorMock {
/// local RAV store with rwlocks to allow sharing with other compenents as needed
Expand Down
24 changes: 6 additions & 18 deletions tap_core/src/tap_receipt/tests/received_receipt_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,8 @@ mod received_receipt_unit_test {
let (executor, escrow_storage, query_appraisal_storage) = auditor_executor;
// give receipt 5 second variance for min start time
let starting_min_timestamp = get_current_timestamp_u64_ns().unwrap() - 500000000;
let receipt_auditor = ReceiptAuditor::new(
domain_separator.clone(),
executor,
// receipt_checks_adapter,
starting_min_timestamp,
);
let receipt_auditor =
ReceiptAuditor::new(domain_separator.clone(), executor, starting_min_timestamp);

let query_value = 20u128;
let signed_receipt = EIP712SignedMessage::new(
Expand Down Expand Up @@ -232,12 +228,8 @@ mod received_receipt_unit_test {
let (executor, escrow_storage, query_appraisal_storage) = auditor_executor;
// give receipt 5 second variance for min start time
let starting_min_timestamp = get_current_timestamp_u64_ns().unwrap() - 500000000;
let receipt_auditor = ReceiptAuditor::new(
domain_separator.clone(),
executor,
// receipt_checks_adapter,
starting_min_timestamp,
);
let receipt_auditor =
ReceiptAuditor::new(domain_separator.clone(), executor, starting_min_timestamp);

let query_value = 20u128;
let signed_receipt = EIP712SignedMessage::new(
Expand Down Expand Up @@ -297,12 +289,8 @@ mod received_receipt_unit_test {
let (executor, escrow_storage, query_appraisal_storage) = auditor_executor;
// give receipt 5 second variance for min start time
let starting_min_timestamp = get_current_timestamp_u64_ns().unwrap() - 500000000;
let receipt_auditor = ReceiptAuditor::new(
domain_separator.clone(),
executor,
// receipt_checks_adapter,
starting_min_timestamp,
);
let receipt_auditor =
ReceiptAuditor::new(domain_separator.clone(), executor, starting_min_timestamp);

let query_value = 20u128;
let signed_receipt = EIP712SignedMessage::new(
Expand Down

0 comments on commit 4692d8b

Please sign in to comment.