Skip to content

Commit

Permalink
Merge pull request #453 from geeksforsocialchange/fix/446-test-runner…
Browse files Browse the repository at this point in the history
…-upgrade

Fix/446 test runner upgrade
  • Loading branch information
katjam authored Oct 31, 2024
2 parents 85ddbe9 + bae60ec commit 474a8cd
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 856 deletions.
4 changes: 2 additions & 2 deletions elm-tooling.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tools": {
"elm": "0.19.1",
"elm-format": "0.8.5",
"elm-test-rs": "2.0.0"
"elm-format": "0.8.7",
"elm-test-rs": "3.0.0"
}
}
85 changes: 46 additions & 39 deletions tests/Page/AboutTests.elm
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
module Page.AboutTests exposing (..)

import Expect
import Html
import Page.About exposing (view)
import Path
import Test exposing (Test, describe, test)
import Test.Html.Query as Query
import Test.Html.Selector as Selector
import TestFixtures exposing (sharedModelInit)
import TestUtils exposing (queryFromStyledList)


viewParamsWithAbout =
{ data =
{ main =
{ title = "About Page Test Title"
, subtitle = "Test subtitle here."
, body = []
}
, accessibility =
{ title = "Accessibility"
, subtitle = "Accessibility is good for everyone"
, body = []
}
, makers =
[ { name = "Makername", url = "google.com", logo = "logo.png", body = [] } ]
, placecal =
{ title = "PlaceCal lives here"
, subtitleimg = "img.jpeg"
, subtitleimgalt = "PlaceCal logo"
, body = []
}
}
, path = Path.fromString "about"
, routeParams = {}
, sharedData = ()
}
import TestUtils exposing (queryFromStyled)
import Theme.Page.About
import Theme.TransMarkdown


introMarkdown =
"# About us"
|> Theme.TransMarkdown.markdownToBlocks
|> fromResult

viewBodyHtml viewParams =
queryFromStyledList
(view Nothing sharedModelInit viewParams).body

fromResult markdownResult =
case markdownResult of
Ok markdownBlocks ->
markdownBlocks

Err _ ->
[]


sectionData =
{ accessibilityData =
{ title = "Accessibility"
, subtitle = "Accessibility is good for everyone"
, body = []
}
, makersData =
[ { name = "Makername", url = "google.com", logo = "logo.png", body = [] } ]
, aboutPlaceCalData =
{ title = "PlaceCal lives here"
, subtitleimg = "img.jpeg"
, subtitleimgalt = "PlaceCal logo"
, body = []
}
}


suite : Test
suite =
describe "About page body"
[ test "Has expected h2 heading" <|
describe "About page"
[ test "Has an intro" <|
\_ ->
Theme.Page.About.viewIntro introMarkdown
|> queryFromStyled
|> Query.find [ Selector.tag "h1" ]
|> Query.contains [ Html.text "About us" ]
, test "Has sections" <|
\_ ->
viewBodyHtml viewParamsWithAbout
|> Query.find [ Selector.tag "h2" ]
|> Query.contains [ Html.text "About Page Test Title" ]
Theme.Page.About.viewSections sectionData
|> queryFromStyled
|> Query.findAll [ Selector.tag "h3" ]
|> Query.count (Expect.equal 3)
]
110 changes: 0 additions & 110 deletions tests/Page/EventTests.elm

This file was deleted.

107 changes: 0 additions & 107 deletions tests/Page/EventsTests.elm

This file was deleted.

66 changes: 0 additions & 66 deletions tests/Page/IndexTests.elm

This file was deleted.

Loading

0 comments on commit 474a8cd

Please sign in to comment.