From 32296f59438f405ae6aebd7a0d244a9e77ad7d8e Mon Sep 17 00:00:00 2001 From: Christopher Angelo Phillips <32073428+spiffcs@users.noreply.github.com> Date: Wed, 12 Jul 2023 13:59:31 -0400 Subject: [PATCH] chore: move wait before iteration to guarantee read before tea (#1931) * chore: move wait before iteration to guarantee read before tea --------- Signed-off-by: Christopher Phillips --- cmd/syft/cli/ui/util_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/syft/cli/ui/util_test.go b/cmd/syft/cli/ui/util_test.go index 745612d73..71cc8809a 100644 --- a/cmd/syft/cli/ui/util_test.go +++ b/cmd/syft/cli/ui/util_test.go @@ -19,6 +19,12 @@ func runModel(t testing.TB, m tea.Model, iterations int, message tea.Msg, h ...* return message } + for _, each := range h { + if each != nil { + each.Wait() + } + } + for i := 0; cmd != nil && i < iterations; i++ { msgs := flatten(cmd()) var nextCmds []tea.Cmd @@ -31,11 +37,6 @@ func runModel(t testing.TB, m tea.Model, iterations int, message tea.Msg, h ...* cmd = tea.Batch(nextCmds...) } - for _, each := range h { - if each != nil { - each.Wait() - } - } return m.View() }