ratemyclient/test/my_first_elixir_vibe_code/reviews_test.exs
Kevin Sivic 9ece312442 Initial commit: RateMyClient™ Phoenix application
Features:
- User registration and authentication with email/password
- Admin login with username-based authentication (separate from regular users)
- Review system for contractors to rate clients
- Star rating system with review forms
- Client identification with private data protection
- Contractor registration with document verification
- Admin dashboard for review management
- Contact form (demo, non-functional)
- Responsive navigation with DaisyUI components
- Docker Compose setup for production deployment
- PostgreSQL database with Ecto migrations
- High Vis color scheme (dark background with safety orange/green)

Admin credentials: username: admin, password: admin123

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:30:50 -05:00

65 lines
2.4 KiB
Elixir

defmodule MyFirstElixirVibeCode.ReviewsTest do
use MyFirstElixirVibeCode.DataCase
alias MyFirstElixirVibeCode.Reviews
describe "reviews" do
alias MyFirstElixirVibeCode.Reviews.Review
import MyFirstElixirVibeCode.ReviewsFixtures
@invalid_attrs %{title: nil, rating: nil, content: nil, project_type: nil}
test "list_reviews/0 returns all reviews" do
review = review_fixture()
assert Reviews.list_reviews() == [review]
end
test "get_review!/1 returns the review with given id" do
review = review_fixture()
assert Reviews.get_review!(review.id) == review
end
test "create_review/1 with valid data creates a review" do
valid_attrs = %{title: "some title", rating: 42, content: "some content", project_type: "some project_type"}
assert {:ok, %Review{} = review} = Reviews.create_review(valid_attrs)
assert review.title == "some title"
assert review.rating == 42
assert review.content == "some content"
assert review.project_type == "some project_type"
end
test "create_review/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = Reviews.create_review(@invalid_attrs)
end
test "update_review/2 with valid data updates the review" do
review = review_fixture()
update_attrs = %{title: "some updated title", rating: 43, content: "some updated content", project_type: "some updated project_type"}
assert {:ok, %Review{} = review} = Reviews.update_review(review, update_attrs)
assert review.title == "some updated title"
assert review.rating == 43
assert review.content == "some updated content"
assert review.project_type == "some updated project_type"
end
test "update_review/2 with invalid data returns error changeset" do
review = review_fixture()
assert {:error, %Ecto.Changeset{}} = Reviews.update_review(review, @invalid_attrs)
assert review == Reviews.get_review!(review.id)
end
test "delete_review/1 deletes the review" do
review = review_fixture()
assert {:ok, %Review{}} = Reviews.delete_review(review)
assert_raise Ecto.NoResultsError, fn -> Reviews.get_review!(review.id) end
end
test "change_review/1 returns a review changeset" do
review = review_fixture()
assert %Ecto.Changeset{} = Reviews.change_review(review)
end
end
end