diff --git a/tests/common/mod.rs b/tests/common/mod.rs new file mode 100644 index 0000000..55a52f4 --- /dev/null +++ b/tests/common/mod.rs @@ -0,0 +1,12 @@ +use soroban_sdk::{contract, contractimpl, Address, Env}; + +/// Shared mock for the Drips protocol contract. +/// Used by both `purge_reward_stream` and `test` integration test suites +/// so the stub only needs to be maintained in one place (issue #199). +#[contract] +pub struct MockDripsContract; + +#[contractimpl] +impl MockDripsContract { + pub fn start_stream(_env: Env, _contributor: Address, _task_id: u64, _resolution_status: u32) {} +} diff --git a/tests/purge_reward_stream.rs b/tests/purge_reward_stream.rs index cd035a1..71c7293 100644 --- a/tests/purge_reward_stream.rs +++ b/tests/purge_reward_stream.rs @@ -4,18 +4,13 @@ // RewardStream(task_id) / AllRewardStreams entries once the task // referenced by that stream has been purged. +mod common; + +use common::MockDripsContract; use soroban_sdk::token::StellarAssetClient; -use soroban_sdk::{contract, contractimpl, testutils::Address as _, Address, Env}; +use soroban_sdk::{testutils::Address as _, Address, Env}; use vero_core_contracts::{Role, VeroContractClient}; -#[contract] -pub struct MockDripsContract; - -#[contractimpl] -impl MockDripsContract { - pub fn start_stream(_env: Env, _contributor: Address, _task_id: u64, _resolution_status: u32) {} -} - const LOCK_THRESHOLD: i128 = 100; fn setup() -> (Env, Address, Address, VeroContractClient<'static>) { diff --git a/tests/test.rs b/tests/test.rs index 3663542..eac2b4e 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,5 +1,8 @@ #![cfg(any())] // Disabled due to upstream breakages +mod common; +use common::MockDripsContract; + use soroban_sdk::token::{Client as TokenClient, StellarAssetClient as TestTokenClient}; use soroban_sdk::{ testutils::{Address as _, Ledger as _}, @@ -1269,13 +1272,6 @@ fn test_simulated_migration_failure_rolls_back() { assert_eq!(client.get_storage_version(), 0); } -#[contract] -pub struct MockDripsContract; - -#[contractimpl] -impl MockDripsContract { - pub fn start_stream(_env: Env, _contributor: Address, _task_id: u64, _resolution_status: u32) {} -} #[test] fn test_purge_done_task_removes_storage() { let (env, _contract_id, admin, token, client) = setup();