Files
BeetRoundServer/test/beet_round_server/bidding_rounds_test.exs

72 lines
2.5 KiB
Elixir

defmodule BeetRoundServer.BiddingRoundsTest do
use BeetRoundServer.DataCase
alias BeetRoundServer.BiddingRounds
describe "bidding_rounds" do
alias BeetRoundServer.BiddingRounds.BiddingRound
import BeetRoundServer.BiddingRoundsFixtures
@invalid_attrs %{stopped: nil, round_number: nil}
test "list_bidding_rounds/0 returns all bidding_rounds" do
bidding_round = bidding_round_fixture()
assert BiddingRounds.list_bidding_rounds() == [bidding_round]
end
test "get_bidding_round!/1 returns the bidding_round with given id" do
bidding_round = bidding_round_fixture()
assert BiddingRounds.get_bidding_round!(bidding_round.id) == bidding_round
end
test "create_bidding_round/1 with valid data creates a bidding_round" do
valid_attrs = %{stopped: true, round_number: 42}
assert {:ok, %BiddingRound{} = bidding_round} =
BiddingRounds.create_bidding_round(valid_attrs)
assert bidding_round.stopped == true
assert bidding_round.round_number == 42
end
test "create_bidding_round/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = BiddingRounds.create_bidding_round(@invalid_attrs)
end
test "update_bidding_round/2 with valid data updates the bidding_round" do
bidding_round = bidding_round_fixture()
update_attrs = %{stopped: false, round_number: 43}
assert {:ok, %BiddingRound{} = bidding_round} =
BiddingRounds.update_bidding_round(bidding_round, update_attrs)
assert bidding_round.stopped == false
assert bidding_round.round_number == 43
end
test "update_bidding_round/2 with invalid data returns error changeset" do
bidding_round = bidding_round_fixture()
assert {:error, %Ecto.Changeset{}} =
BiddingRounds.update_bidding_round(bidding_round, @invalid_attrs)
assert bidding_round == BiddingRounds.get_bidding_round!(bidding_round.id)
end
test "delete_bidding_round/1 deletes the bidding_round" do
bidding_round = bidding_round_fixture()
assert {:ok, %BiddingRound{}} = BiddingRounds.delete_bidding_round(bidding_round)
assert_raise Ecto.NoResultsError, fn ->
BiddingRounds.get_bidding_round!(bidding_round.id)
end
end
test "change_bidding_round/1 returns a bidding_round changeset" do
bidding_round = bidding_round_fixture()
assert %Ecto.Changeset{} = BiddingRounds.change_bidding_round(bidding_round)
end
end
end