github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/tests/SubPageTests.elm (about) 1 module SubPageTests exposing (all) 2 3 import Application.Application as Application 4 import Common 5 import Data 6 import Dict exposing (Dict) 7 import Expect 8 import Http 9 import Message.Callback exposing (Callback(..)) 10 import NotFound.Model 11 import Routes 12 import SubPage.SubPage exposing (..) 13 import Test exposing (..) 14 import Url 15 16 17 all : Test 18 all = 19 describe "SubPage" 20 [ describe "not found" <| 21 let 22 init : String -> () -> Application.Model 23 init path _ = 24 Common.init path 25 in 26 [ test "JobNotFound" <| 27 init "/teams/t/pipelines/p/jobs/j" 28 >> Application.handleCallback (JobFetched Data.httpNotFound) 29 >> Tuple.first 30 >> .subModel 31 >> Expect.equal 32 (NotFoundModel 33 (notFound 34 (Routes.Job 35 { id = Data.shortJobId 36 , page = Nothing 37 } 38 ) 39 ) 40 ) 41 , test "Resource not found" <| 42 init "/teams/t/pipelines/p/resources/r" 43 >> Application.handleCallback 44 (ResourceFetched Data.httpNotFound) 45 >> Tuple.first 46 >> .subModel 47 >> Expect.equal 48 (NotFoundModel 49 (notFound 50 (Routes.Resource 51 { id = Data.shortResourceId 52 , page = Nothing 53 } 54 ) 55 ) 56 ) 57 , test "Build not found" <| 58 init "/builds/1" 59 >> Application.handleCallback (BuildFetched Data.httpNotFound) 60 >> Tuple.first 61 >> .subModel 62 >> Expect.equal 63 (NotFoundModel 64 (notFound 65 (Routes.OneOffBuild 66 { id = 1 67 , highlight = Routes.HighlightNothing 68 } 69 ) 70 ) 71 ) 72 , test "Pipeline not found" <| 73 init "/teams/t/pipelines/p" 74 >> Application.handleCallback 75 (PipelineFetched Data.httpNotFound) 76 >> Tuple.first 77 >> .subModel 78 >> Expect.equal 79 (NotFoundModel 80 (notFound 81 (Routes.Pipeline 82 { id = Data.shortPipelineId 83 , groups = [] 84 } 85 ) 86 ) 87 ) 88 ] 89 ] 90 91 92 notFound : Routes.Route -> NotFound.Model.Model 93 notFound route = 94 { notFoundImgSrc = "notfound.svg" 95 , isUserMenuExpanded = False 96 , route = route 97 }