11// Copyright 2023-, Edge & Node, GraphOps, and Semiotic Labs.
22// SPDX-License-Identifier: Apache-2.0
33
4- //! Simple SubgraphClient Abstraction for Testing
4+ //! TAP SubgraphClient Abstraction for Testing
55//!
66//! This provides a minimal abstraction to enable Layer 2 integration testing
77//! without the complexity of async trait objects.
@@ -12,24 +12,24 @@ use indexer_monitor::SubgraphClient;
1212use serde_json;
1313use std:: sync:: Arc ;
1414
15- /// Simple enum wrapper for different SubgraphClient implementations
15+ /// TAP-specific enum wrapper for different SubgraphClient implementations
1616/// This solves the dependency injection problem for testing
1717#[ derive( Clone ) ]
18- pub enum SimpleSubgraphClient {
18+ pub enum TapSubgraphClient {
1919 /// Production implementation using real SubgraphClient
2020 Production ( Arc < SubgraphClient > ) ,
2121 /// Mock implementation for testing
22- Mock ( SimpleSubgraphMock ) ,
22+ Mock ( TapSubgraphMock ) ,
2323}
2424
25- impl SimpleSubgraphClient {
25+ impl TapSubgraphClient {
2626 /// Create a production client wrapper
2727 pub fn production ( client : Arc < SubgraphClient > ) -> Self {
2828 Self :: Production ( client)
2929 }
3030
3131 /// Create a mock client for testing
32- pub fn mock ( mock : SimpleSubgraphMock ) -> Self {
32+ pub fn mock ( mock : TapSubgraphMock ) -> Self {
3333 Self :: Mock ( mock)
3434 }
3535
@@ -188,16 +188,16 @@ impl SimpleSubgraphClient {
188188 }
189189}
190190
191- /// Simple mock for testing SubgraphClient behavior
191+ /// TAP-specific mock for testing SubgraphClient behavior
192192#[ derive( Clone ) ]
193- pub struct SimpleSubgraphMock {
193+ pub struct TapSubgraphMock {
194194 /// Controls whether allocation validation succeeds
195195 pub should_validate_allocation : bool ,
196196 /// Controls whether the client appears healthy
197197 pub is_healthy : bool ,
198198}
199199
200- impl SimpleSubgraphMock {
200+ impl TapSubgraphMock {
201201 /// Create a new mock with default settings
202202 pub fn new ( ) -> Self {
203203 Self {
@@ -219,7 +219,7 @@ impl SimpleSubgraphMock {
219219 }
220220}
221221
222- impl Default for SimpleSubgraphMock {
222+ impl Default for TapSubgraphMock {
223223 fn default ( ) -> Self {
224224 Self :: new ( )
225225 }
@@ -233,8 +233,8 @@ mod tests {
233233
234234 #[ tokio:: test]
235235 async fn test_mock_allocation_validation_success ( ) {
236- let mock = SimpleSubgraphMock :: new ( ) . with_allocation_validation ( true ) ;
237- let client = SimpleSubgraphClient :: mock ( mock) ;
236+ let mock = TapSubgraphMock :: new ( ) . with_allocation_validation ( true ) ;
237+ let client = TapSubgraphClient :: mock ( mock) ;
238238
239239 let test_address = Address :: from ( [ 0x42 ; 20 ] ) ;
240240 let allocation_id = AllocationId :: Legacy ( test_address. into ( ) ) ;
@@ -245,8 +245,8 @@ mod tests {
245245
246246 #[ tokio:: test]
247247 async fn test_mock_allocation_validation_failure ( ) {
248- let mock = SimpleSubgraphMock :: new ( ) . with_allocation_validation ( false ) ;
249- let client = SimpleSubgraphClient :: mock ( mock) ;
248+ let mock = TapSubgraphMock :: new ( ) . with_allocation_validation ( false ) ;
249+ let client = TapSubgraphClient :: mock ( mock) ;
250250
251251 let test_address = Address :: from ( [ 0x42 ; 20 ] ) ;
252252 let allocation_id = AllocationId :: Legacy ( test_address. into ( ) ) ;
@@ -257,11 +257,11 @@ mod tests {
257257
258258 #[ tokio:: test]
259259 async fn test_mock_health_check ( ) {
260- let healthy_mock = SimpleSubgraphMock :: new ( ) . with_health_status ( true ) ;
261- let healthy_client = SimpleSubgraphClient :: mock ( healthy_mock) ;
260+ let healthy_mock = TapSubgraphMock :: new ( ) . with_health_status ( true ) ;
261+ let healthy_client = TapSubgraphClient :: mock ( healthy_mock) ;
262262
263- let unhealthy_mock = SimpleSubgraphMock :: new ( ) . with_health_status ( false ) ;
264- let unhealthy_client = SimpleSubgraphClient :: mock ( unhealthy_mock) ;
263+ let unhealthy_mock = TapSubgraphMock :: new ( ) . with_health_status ( false ) ;
264+ let unhealthy_client = TapSubgraphClient :: mock ( unhealthy_mock) ;
265265
266266 assert ! ( healthy_client. is_healthy( ) . await ) ;
267267 assert ! ( !unhealthy_client. is_healthy( ) . await ) ;
0 commit comments