Skip to content

Commit

Permalink
more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Nov 15, 2023
1 parent 443a76c commit 95d11bf
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/docs/mechanics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,23 @@ def notify(ctx, model:, params:, **)
signal, (ctx, _) = Trailblazer::Activity.(Memo::Activity::Create, params: {memo: nil, network_broken: false})
assert_equal signal.to_h[:semantic], :success #!hint assert_equal result.success?, true

signal, (ctx, _) = Trailblazer::Activity.(Memo::Activity::Create, params: {memo: nil, network_broken: true})
#:terminus
signal, (ctx, _) = Trailblazer::Activity.(Memo::Activity::Create, params: {memo: nil, network_broken: true}) #!hint result = Memo::Operation::Create.(params: {memo: nil, network_broken: true})

signal.to_h[:semantic] #=> :network_error #!hint result.terminus.to_h[:semantic] #=> :network_error
#:terminus end
assert_equal signal.to_h[:semantic], :network_error #!hint assert_equal result.success?, false
assert_equal signal.inspect, %(#<Trailblazer::Activity::End semantic=:network_error>) #!hint assert_equal result.event.inspect, %(#<Trailblazer::Activity::End semantic=:network_error>)
assert_equal signal.inspect, %(#<Trailblazer::Activity::End semantic=:network_error>) #!hint assert_equal result.terminus.to_h[:semantic], :network_error

#:terminus-subprocess
module Endpoint
class API < Trailblazer::Activity::Railway
step Subprocess(Memo::Activity::Create),
Output(:network_error) => Track(:failure)
# ...
end
end
#:terminus-subprocess end
end
end

Expand Down

0 comments on commit 95d11bf

Please sign in to comment.