Skip to content

Commit

Permalink
fix: Swap the sense of the Regex.match? call in route_symbols_test (#…
Browse files Browse the repository at this point in the history
…2234)

This makes assertions less picky. For instance:

    "Massport Route 55" |> Regex.compile!("i") |> Regex.match?("Massport")

is `false`, but

    "Massport" |> Regex.compile!("i") |> Regex.match?("Massport Route 55")

is `true`.
  • Loading branch information
joshlarson authored Nov 22, 2024
1 parent 17c108a commit 205796d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/dotcom_web/components/route_symbols_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ defmodule DotcomWeb.Components.RouteSymbolsTest do
end

defp matches_title?(html, text) do
html
|> Floki.find("title")
|> Floki.text()
|> String.trim()
title =
html
|> Floki.find("title")
|> Floki.text()
|> String.trim()

text
|> Regex.compile!("i")
|> Regex.match?(text)
|> Regex.match?(title)
end
end

0 comments on commit 205796d

Please sign in to comment.