Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using Mocker in combination with SwiftUI and Snapshot testing #159

Open
teameh opened this issue Sep 30, 2024 · 4 comments
Open

Comments

@teameh
Copy link

teameh commented Sep 30, 2024

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?

Copy link

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.

@github-actions github-actions bot added the Stale label Oct 31, 2024
@teameh
Copy link
Author

teameh commented Oct 31, 2024

@AvdLee ?

@github-actions github-actions bot removed the Stale label Nov 1, 2024
Copy link

github-actions bot commented Dec 1, 2024

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.

@github-actions github-actions bot added the Stale label Dec 1, 2024
@teameh
Copy link
Author

teameh commented Dec 1, 2024

Still relevant

@github-actions github-actions bot removed the Stale label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant