Skip to content

Commit 43eb39e

Browse files
committed
PM-25300 Add Sourcery usage on iOS architecture.
1 parent 02ea64f commit 43eb39e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

custom-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ SDLC
7171
Serilog
7272
signtool
7373
signup
74+
Sourcery
7475
sqlcmd
7576
struct
7677
structs

docs/architecture/mobile-clients/ios/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,27 @@ This makes it convenient to switch between these files or open them side-by-side
444444
mode, dark mode, and with a large dynamic type size. ⚠️ These tests are done using an **iPhone 15
445445
Pro (17.0.1)** simulator, otherwise tests may fail because of subtle differences between iOS
446446
versions.
447+
448+
### Mocks generation
449+
450+
We use [Sourcery](https://github.com/krzysztofzablocki/Sourcery) for automatic mock generation.
451+
452+
In order to automatically generate a mock from a protocol, just add a comment with
453+
`// sourcery: AutoMockable` to such protocol, perform a build and the mock will be automatically
454+
generated and added to the `AutoMockable.generated.swift` file.
455+
456+
For example:
457+
458+
```swift
459+
protocol FooProtocol { // sourcery: AutoMockable
460+
func bar() -> Bool
461+
}
462+
```
463+
464+
:::info Manual generation
465+
466+
There are some cases where the automatically generated mock does not cover the mock scenario we want
467+
or it cannot handle some closure types, specially in function's parameters. In such cases prefer
468+
create the mock manually and remove the protocol's comment as `AutoMockable`.
469+
470+
:::

0 commit comments

Comments
 (0)