From 205796d16afd9867bae08113ef712d1f71a23efb Mon Sep 17 00:00:00 2001 From: Josh Larson Date: Thu, 21 Nov 2024 21:58:09 -0500 Subject: [PATCH] fix: Swap the sense of the Regex.match? call in route_symbols_test (#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`. --- test/dotcom_web/components/route_symbols_test.exs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/dotcom_web/components/route_symbols_test.exs b/test/dotcom_web/components/route_symbols_test.exs index 0e1743bdd7..7fbae8be0a 100644 --- a/test/dotcom_web/components/route_symbols_test.exs +++ b/test/dotcom_web/components/route_symbols_test.exs @@ -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