Skip to content

Commit

Permalink
cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Feb 16, 2024
1 parent fab714b commit 9a96d3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
2 changes: 0 additions & 2 deletions lib/trailblazer/workflow/discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def call(collaboration, start_position:, run_multiple_times: {}, initial_lane_po
next if suspend_terminus.instance_of?(Trailblazer::Activity::End) # a real end event!
# elsif suspend_terminus.is_a?(Trailblazer::Activity::Railway::End) # a real end event!

# raise suspend_terminus.inspect

# Go through all possible resume/catch events and "remember" them
suspend_terminus.to_h["resumes"].each do |resume_event_id|
resume_event = Trailblazer::Activity::Introspect.Nodes(last_lane, id: resume_event_id).task
Expand Down
22 changes: 6 additions & 16 deletions test/discovery_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,28 +191,24 @@ class DiscoveryTest < Minitest::Spec
lanes: lanes_sorted

assert_nil states[15]


end

# Asserts
# * that positions are always sorted by activity.
def assert_position_before(actual_positions, expected_ids, start_id:, lanes:)
actual_lane_positions, actual_start_position = actual_positions

_assert_positions(actual_lane_positions, expected_ids, lanes: lanes)
assert_positions_for(actual_lane_positions, expected_ids, lanes: lanes)

assert_equal Trailblazer::Activity::Introspect.Nodes(actual_start_position.activity, task: actual_start_position.task).id, start_id, "start task mismatch"
end

def _assert_positions(actual_lane_positions, expected_ids, lanes:)
puts actual_lane_positions.collect { |(a, t)|
puts "@@@@@..... #{a.inspect} #{t}"

Trailblazer::Activity::Introspect.Nodes(a, task: t).id }.inspect
def assert_positions_for(actual_lane_positions, expected_ids, lanes:)
# puts actual_lane_positions.collect { |(a, t)| Trailblazer::Activity::Introspect.Nodes(a, task: t).id }.inspect

# FIXME: always use Positions -> Position
actual_lane_positions.collect.with_index do |actual_position, index|
raise actual_position.inspect if actual_position.class == Array # FIXME: remove me.
actual_activity, actual_task = actual_position.to_a

expected_activity = lanes[index]
Expand All @@ -223,14 +219,8 @@ def _assert_positions(actual_lane_positions, expected_ids, lanes:)
end

def assert_position_after(actual_configuration, expected_ids, lanes:)
actual_positions = actual_configuration.lane_positions.to_a

# FIXME: always use Configuration -> Positions -> Position
actual_positions = actual_positions.collect.with_index do |actual_position, index|
actual_activity, actual_task = actual_position.to_a
end

actual_positions = actual_configuration.lane_positions

_assert_positions(actual_positions, expected_ids, lanes: lanes)
assert_positions_for(actual_positions, expected_ids, lanes: lanes)
end
end

0 comments on commit 9a96d3d

Please sign in to comment.