WeTransfer/Mocker

Error when using Mocker in combination with SwiftUI and Snapshot testing

Opened this issue · 6 comments

I'm trying to use Mocker in combination with SwiftUI and Snapshot testing.

I'm using Xcode assets symbol generation to get my images from the asset catalogue: Image(.myLogo)

When I snapshot a SwiftUI view thats uses this image, all goes well, but when I use Mocker to mock some other requests in some other tests. The resulted snapshot shows me a cross instead of the image:

image

And my error log tells me:

 🚨 No mocked data found for url Optional("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABtUAAAEKCAYAAABt6tqOAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAG1aADAAQAAAABAAABCgAAAADIQdNhAABAAElEQVR4Ae3d7XXbSLYoUGtW/5deBOJE ...... ABJRU5ErkJggg==") method Optional("GET"). Did you forget to use `register()`? 🚨 

Setting the mode to opt-in fixes this:

Mocker.mode = .optin

But shouldn't be necessary. Did somebody see this before?

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

Still relevant

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

teameh commented

Still relevant