Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions broker/patron_request/service/action_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@ func TestGetActionTransitionConditionPendingSelfTransition(t *testing.T) {
assert.Equal(t, LenderStateConditionPending, transition)
}

func TestGetEventTransitionRetryConditionalFromBorrowerWillSupply(t *testing.T) {
mapping := mustActionMapping(t)

transition, stateChanged, eventDefined := mapping.GetEventTransition(
pr_db.PatronRequest{Side: SideBorrowing, State: BorrowerStateWillSupply},
string(SupplierRetryConditional),
)
assert.True(t, eventDefined)
assert.True(t, stateChanged)
assert.Equal(t, BorrowerStateRetryPending, transition)
}

func listCompare(t *testing.T, list1 []pr_db.PatronRequestAction, list2 []pr_db.PatronRequestAction) {
assert.Equal(t, len(list1), len(list2), "list1=%v, list2=%v", list1, list2)
for i := range list1 {
Expand Down
5 changes: 5 additions & 0 deletions broker/patron_request/service/statemodels/state-models.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@
"desc": "Supplier adds conditions after initial WillSupply (ISO18626 WillSupply with conditions)",
"transition": "CONDITION_PENDING"
},
{
"name": "retry-conditional",
"desc": "Received retry from supplier",
"transition": "RETRY_PENDING"
},
{
"name": "loaned",
"desc": "Supplier shipped the item (ISO18626 Loaned)",
Expand Down
3 changes: 3 additions & 0 deletions misc/state-models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ stateModels:
- name: will-supply-conditional
desc: "Supplier adds conditions after initial WillSupply (ISO18626 WillSupply with conditions)"
transition: CONDITION_PENDING
- name: retry-conditional
desc: Received retry from supplier
transition: RETRY_PENDING
- name: loaned
desc: "Supplier shipped the item (ISO18626 Loaned)"
transition: SHIPPED
Expand Down
Loading