Skip to content

Commit

Permalink
remove magic number in test!
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed May 6, 2024
1 parent 72bab36 commit 7e204ca
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/route_patterns/repo_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ defmodule RoutePatterns.RepoTest do

describe "get" do
test "returns a single route pattern" do
expect(MBTA.Api.Mock, :get_json, fn url, _ ->
assert url == "/route_patterns/111-5-0"
id = Faker.Internet.slug()

expect(MBTA.Api.Mock, :get_json, fn path, _ ->
assert path == "/route_patterns/" <> id

%JsonApi{
data: [
build(:route_pattern_item, id: "111-5-0")
build(:route_pattern_item, id: id)
]
}
end)

assert %RoutePattern{id: "111-5-0"} = RoutePatterns.Repo.get("111-5-0")
assert %RoutePattern{id: ^id} = RoutePatterns.Repo.get(id)
end

test "returns nil for an unknown route pattern" do
Expand Down

0 comments on commit 7e204ca

Please sign in to comment.