mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
30 lines
1.3 KiB
Elm
30 lines
1.3 KiB
Elm
module NoExposingEverythingTest exposing (all)
|
|
|
|
import NoExposingEverything exposing (rule)
|
|
import Review.Test
|
|
import Test exposing (Test, describe, test)
|
|
|
|
|
|
all : Test
|
|
all =
|
|
describe "NoExposingEverything"
|
|
[ test "should not when a module exposes a limited set of things" <|
|
|
\_ ->
|
|
"module A exposing (B(..), C, d)"
|
|
|> Review.Test.run rule
|
|
|> Review.Test.expectNoErrors
|
|
, test "should report when a module exposes everything" <|
|
|
\_ ->
|
|
"module A exposing (..)"
|
|
|> Review.Test.run rule
|
|
|> Review.Test.expectErrors
|
|
[ Review.Test.error
|
|
{ message = "Module exposes everything implicitly \"(..)\""
|
|
, details =
|
|
[ "Modules should have hidden implementation details with an explicit API so that the module is used in a proper and controlled way. The users of this module should not have to know about what is inside a module it is using, and they shouldn't need to access it's internal details. Therefore, the API should be explicitly defined and ideally as small as possible."
|
|
]
|
|
, under = "(..)"
|
|
}
|
|
]
|
|
]
|