commit 6d3f2aee24ea2f668402c48a28e316dd067596bf
parent 3a252a89810b832c919102cff7644a48c1da6974
Author: srfsh <dev@srf.sh>
Date: Tue, 13 Dec 2022 20:40:14 +0300
ZenflowsTest.VF.Proposal.Domain: add tests for state/1
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/test/vf/proposal/domain.test.exs b/test/vf/proposal/domain.test.exs
@@ -48,6 +48,27 @@ describe "one/1" do
end
end
+describe "state/1" do
+ test "pending", %{inserted: proposal} do
+ int = Factory.insert!(:intent, finished: false)
+ Factory.insert!(:proposed_intent, published_in: proposal, publishes: int)
+ assert {:ok, :pending} = Domain.state(proposal.id)
+ end
+
+ test "accepted", %{inserted: proposal} do
+ int = Factory.insert!(:intent, finished: false)
+ Factory.insert!(:proposed_intent, published_in: proposal, publishes: int)
+ Factory.insert!(:satisfaction, satisfies: int)
+ assert {:ok, :accepted} = Domain.state(proposal.id)
+ end
+
+ test "refused", %{inserted: proposal} do
+ int = Factory.insert!(:intent, finished: true)
+ Factory.insert!(:proposed_intent, published_in: proposal, publishes: int)
+ assert {:ok, :refused} = Domain.state(proposal.id)
+ end
+end
+
describe "create/1" do
test "with good params: creates a Proposal", %{params: params} do
assert {:ok, %Proposal{} = new} = Domain.create(params)