Skip to content

Commit

Permalink
feat: add & rebase tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pheetah committed Dec 28, 2023
1 parent d7b01fd commit 9d67b49
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions tests/test_node_adder.py → tests/test_language_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,45 @@ def test_can_separate_multiple_sources(self):
self.node_adder._handle_activity(token=TOKEN, diagram=diagram)

# After
actvity: ActivityNode = diagram.head
activity: ActivityNode = diagram.head

assert actvity._description == "find related tax rates"
assert actvity._database == "banking.rates"
assert set(actvity._outgoing_api_calls) == set(["id"])
assert set(actvity._incoming_api_calls) == set(["tax_rate_list", "permissions"])
assert activity._description == "find related tax rates"
assert activity._database == "banking.rates"
assert set(activity._outgoing_api_calls) == set(["id"])
assert set(activity._incoming_api_calls) == set(
["tax_rate_list", "permissions"]
)

assert activity.next is None

def test_can_cascade_multiple_nodes(self):
# Before
diagram = EpcDiagram()
TOKEN = (
f"# {Keywords.ACTIVITY} find related tax rates "
"[=] banking.rates "
f"{Keywords.ACTIVITY} fetch tax rates and permissions "
"-> id <- tax_rate_list, permissions "
f"{Keywords.EVENT} payment completed"
)

# Test
self.node_adder._handle_flow(token=TOKEN, diagram=diagram)

# After
# Assert first node
first_node: ActivityNode = diagram.head
assert first_node._description == "find related tax rates"
assert first_node._database == "banking.rates"

# Assert next node
second_node = first_node.next
assert set(second_node._outgoing_api_calls) == set(["id"])
assert set(second_node._incoming_api_calls) == set(
["tax_rate_list", "permissions"]
)

assert actvity.next is None
# Assert next node
third_node = second_node.next
assert third_node._description == "payment completed"
assert third_node.next is None

0 comments on commit 9d67b49

Please sign in to comment.