File tree Expand file tree Collapse file tree
Tests/NetLensTests/Helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //
2+ // NetworkCall.swift
3+ // NetLens
4+ //
5+ // Created by NetLens on 25/06/2025.
6+ //
7+
8+ @testable import NetLens
9+
10+ import Foundation
11+
12+ class NetworkCallFactory {
13+
14+ static func makeSuccessCall(
15+ url: String = " https://www.api.test.com/success " ,
16+ method: HTTPMethod = . GET
17+ ) -> NetworkCall {
18+ NetworkCall (
19+ url: URL ( string: url) !,
20+ method: method,
21+ statusCode: 200 ,
22+ timeStamp: Date ( ) ,
23+ duration: . milliseconds( 500 )
24+ )
25+ }
26+
27+ static func makeFailedCall(
28+ url: String = " https://www.api.test.com/success " ,
29+ method: HTTPMethod = . GET,
30+ statusCode: Int = 400
31+ ) -> NetworkCall {
32+ NetworkCall (
33+ url: URL ( string: url) !,
34+ method: method,
35+ statusCode: statusCode,
36+ timeStamp: Date ( ) ,
37+ duration: . seconds( 1 ) ,
38+ error: NetworkError (
39+ code: statusCode,
40+ message: " Not Found "
41+ )
42+ )
43+ }
44+ }
45+
You can’t perform that action at this time.
0 commit comments