mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 21:02:33 +03:00
Ensure that ActionData is exposed.
This commit is contained in:
parent
cd049aaebb
commit
ec40fa4740
@ -146,7 +146,7 @@ moduleDefinitionVisitor node context =
|
||||
Exposing.Explicit exposedValues ->
|
||||
case context.isRouteModule of
|
||||
Just RouteModule ->
|
||||
case Set.diff (Set.fromList [ "Data", "Msg", "Model", "route" ]) (exposedNames exposedValues) |> Set.toList of
|
||||
case Set.diff (Set.fromList [ "ActionData", "Data", "Msg", "Model", "route" ]) (exposedNames exposedValues) |> Set.toList of
|
||||
[] ->
|
||||
( [], context )
|
||||
|
||||
@ -158,6 +158,7 @@ moduleDefinitionVisitor node context =
|
||||
|
||||
- route
|
||||
- Data
|
||||
- ActionData
|
||||
- Model
|
||||
- Msg
|
||||
|
||||
|
@ -10,7 +10,7 @@ all =
|
||||
describe "Pages.Review.NoContractViolations"
|
||||
[ test "reports error when missing exposed declaration" <|
|
||||
\() ->
|
||||
"""module Route.Blog.Slug_ exposing (Data, Msg, route)
|
||||
"""module Route.Blog.Slug_ exposing (ActionData, Data, Msg, route)
|
||||
|
||||
a = 1
|
||||
"""
|
||||
@ -24,19 +24,20 @@ a = 1
|
||||
|
||||
- route
|
||||
- Data
|
||||
- ActionData
|
||||
- Model
|
||||
- Msg
|
||||
|
||||
But it is not exposing: Model"""
|
||||
]
|
||||
, under = "exposing (Data, Msg, route)"
|
||||
, under = "exposing (ActionData, Data, Msg, route)"
|
||||
}
|
||||
]
|
||||
)
|
||||
]
|
||||
, test "reports RouteParams mismatch" <|
|
||||
\() ->
|
||||
"""module Route.Blog.Slug_ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Blog.Slug_ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = { blogPostName : String }
|
||||
|
||||
@ -60,7 +61,7 @@ type alias RouteParams = { slug : String }
|
||||
]
|
||||
, test "reports incorrect types for optional RouteParams" <|
|
||||
\() ->
|
||||
"""module Route.Docs.Section_.SubSection__ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Docs.Section_.SubSection__ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = { section : String, subSection : String }
|
||||
|
||||
@ -84,7 +85,7 @@ type alias RouteParams = { section : String, subSection : Maybe String }
|
||||
]
|
||||
, test "reports incorrect types for required splat RouteParams" <|
|
||||
\() ->
|
||||
"""module Route.Docs.Section_.SPLAT_ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Docs.Section_.SPLAT_ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = { section : String, splat : List String }
|
||||
|
||||
@ -108,7 +109,7 @@ type alias RouteParams = { section : String, splat : ( String, List String ) }
|
||||
]
|
||||
, test "no error for valid SPLAT_ RouteParams" <|
|
||||
\() ->
|
||||
"""module Route.Docs.Section_.SPLAT_ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Docs.Section_.SPLAT_ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = { section : String, splat : ( String, List String ) }
|
||||
|
||||
@ -118,7 +119,7 @@ route = {}
|
||||
|> Review.Test.expectNoErrors
|
||||
, test "no error for valid SPLAT__ RouteParams" <|
|
||||
\() ->
|
||||
"""module Route.Docs.Section_.SPLAT__ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Docs.Section_.SPLAT__ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = { section : String, splat : List String }
|
||||
|
||||
@ -128,7 +129,7 @@ route = {}
|
||||
|> Review.Test.expectNoErrors
|
||||
, test "no error for matching RouteParams name" <|
|
||||
\() ->
|
||||
"""module Route.Blog.Slug_ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Blog.Slug_ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = { slug : String }
|
||||
|
||||
@ -138,7 +139,7 @@ route = {}
|
||||
|> Review.Test.expectNoErrors
|
||||
, test "error when RouteParams type is not a record" <|
|
||||
\() ->
|
||||
"""module Route.Blog.Slug_ exposing (Data, route, Model, Msg)
|
||||
"""module Route.Blog.Slug_ exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = ()
|
||||
|
||||
@ -169,7 +170,7 @@ route = {}
|
||||
|> Review.Test.expectNoErrors
|
||||
, test "error for missing application module definitions" <|
|
||||
\() ->
|
||||
[ """module Route.Index exposing (Data, route, Model, Msg)
|
||||
[ """module Route.Index exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = {}
|
||||
|
||||
@ -198,7 +199,7 @@ config =
|
||||
]
|
||||
, test "no error when all core modules are defined" <|
|
||||
\() ->
|
||||
("""module Route.Index exposing (Data, route, Model, Msg)
|
||||
("""module Route.Index exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = {}
|
||||
|
||||
@ -210,7 +211,7 @@ route = {}
|
||||
|> Review.Test.expectNoErrors
|
||||
, test "show missing exposed values from core modules" <|
|
||||
\() ->
|
||||
[ """module Route.Index exposing (Data, route, Model, Msg)
|
||||
[ """module Route.Index exposing (ActionData, Data, route, Model, Msg)
|
||||
|
||||
type alias RouteParams = {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user