Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ SDLC
Serilog
signtool
signup
Sourcery
sqlcmd
struct
structs
Expand Down
24 changes: 24 additions & 0 deletions docs/architecture/mobile-clients/ios/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,27 @@ This makes it convenient to switch between these files or open them side-by-side
mode, dark mode, and with a large dynamic type size. โš ๏ธ These tests are done using an **iPhone 15
Pro (17.0.1)** simulator, otherwise tests may fail because of subtle differences between iOS
versions.

### Mocks generation

We use [Sourcery](https://github.com/krzysztofzablocki/Sourcery) for automatic mock generation.

In order to automatically generate a mock from a protocol, just add a comment with
`// sourcery: AutoMockable` to such protocol, perform a build and the mock will be automatically
generated and added to the `AutoMockable.generated.swift` file.

For example:

```swift
protocol FooProtocol { // sourcery: AutoMockable
func bar() -> Bool
}
```

:::info Manual generation

There are some cases where the automatically generated mock does not cover the mock scenario we want
or it cannot handle some closure types, specially in function's parameters. In such cases prefer
create the mock manually and remove the protocol's comment as `AutoMockable`.

:::