-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split DependencyFakeable from Fakeable
- Loading branch information
Showing
3 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// DependencyFakeable.swift | ||
// SabyTestFake | ||
// | ||
// Created by WOF on 11/13/23. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol DependencyFakeable<Dependency> { | ||
associatedtype Dependency: Fakeable | ||
|
||
static func fake(dependency: Dependency) -> Self | ||
} | ||
|
||
extension DependencyFakeable { | ||
static func fake(apply: (inout Dependency) -> Void) -> (Self, Dependency) { | ||
var dependency = Dependency.fake() | ||
apply(&dependency) | ||
|
||
let instance = Self.fake(dependency: dependency) | ||
|
||
return (instance, dependency) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters