Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineAugusti committed Jan 20, 2025
1 parent c85561f commit 324d54d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/transport/test/transport/csv_documents_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ defmodule Transport.CSVDocumentsTest do
# Check `operator` values. Prevent typos and ensure unique values.
# Detect things like `Cykleo` VS `Cykléo`.
for x <- operators, y <- operators, x != y do
assert String.jaro_distance(x, y) <= 0.75, "#{x} and #{y} look too similar. Is it the same operator?"
error_message = "#{x} and #{y} look too similar. Is it the same operator?"
assert String.jaro_distance(x, y) <= 0.75 || distinct_operators?(x, y), error_message
end

# Check `url` values. Make sure there is at most a single match per GBFS feed.
Expand All @@ -43,4 +44,11 @@ defmodule Transport.CSVDocumentsTest do
refute String.contains?(x, y), "#{x} is contained #{y}. A GBFS feed can only match for a single URL."
end
end

def distinct_operators?(x, y) do
[
["Citiz", "Citybike"]
]
|> Enum.member?(Enum.sort([x, y]))
end
end

0 comments on commit 324d54d

Please sign in to comment.