MakeAWishFoundation / SwiftyMocky

Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.03k stars 104 forks source link

Mocked return value is different for different cases #358

Open shurale85 opened 6 months ago

shurale85 commented 6 months ago

Hi! Not really sure if this is an issue. I guess I miss smth internal of swiftymoky. I have protocol:

// this is from object
public protocol MailAddressProtocol: AutoMockable {
    var mailbox: String? { get }
    var displayName: String? { get }
}

public extension MailAddressProtocol {
    var title: String? {
        guard let displayName = self.displayName else {
            return mailbox
        }

        return displayName
    }
}

However, my expectation is failed. from.title returns "test title" and header.from!.title returns nil

When I call from.title it returns given value and when I call header.from!.title it returns value from title of extension MailAddressProtocol. I can't understand why does the same object from have different behavior.

telegram-cloud-photo-size-2-5377773627459623126-x