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

How would you test a .task ? #1

Open
smiLLe opened this issue Mar 28, 2024 · 2 comments
Open

How would you test a .task ? #1

smiLLe opened this issue Mar 28, 2024 · 2 comments

Comments

@smiLLe
Copy link

smiLLe commented Mar 28, 2024

How would I test an async task in a View which just shows some simple data, loaded from an api?

.task {
   let result = await api.loadData()
   self.data = result
}
@sisoje
Copy link
Owner

sisoje commented Aug 12, 2024

@smiLLe hey sorry I just saw. I think to prepare my own testing framewrok. The way is to find a task, find the async action and trigger it. Similar for refreshable.

@pro100filipp
Copy link

I prefer action-inspired approach. You wrap your task code in a method like func viewAppeared() async and do the work inside it. Then you just test this method.

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

3 participants