Skip to content

Commit 899f337

Browse files
committed
Add test coverage for missing workflow in humanize_search_params
Adds test case to cover the nil branch when a workflow_id filter references a workflow that doesn't exist in the workflows list.
1 parent 6dc8560 commit 899f337

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/lightning_web/live/run_live/components_test.exs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,4 +621,32 @@ defmodule LightningWeb.RunLive.ComponentsTest do
621621
)
622622
|> Enum.any?()
623623
end
624+
625+
describe "bulk_rerun_modal/1" do
626+
test "handles missing workflow in humanize_search_params" do
627+
workflow = insert(:simple_workflow)
628+
workflows = [{"Test Workflow", workflow.id}]
629+
630+
filters = %Lightning.WorkOrders.SearchParams{
631+
workflow_id: Ecto.UUID.generate()
632+
}
633+
634+
html =
635+
render_component(&Components.bulk_rerun_modal/1,
636+
id: "bulk-rerun-modal",
637+
show: true,
638+
all_selected?: true,
639+
selected_count: 5,
640+
page_number: 1,
641+
pages: 2,
642+
total_entries: 10,
643+
filters: filters,
644+
workflows: workflows
645+
)
646+
647+
assert html =~ "Run Selected Work Orders"
648+
assert html =~ "You've selected all 5 work orders"
649+
refute html =~ "for #{workflow.name} workflow"
650+
end
651+
end
624652
end

0 commit comments

Comments
 (0)