forked from etaque/elm-form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValidationTests.elm
32 lines (29 loc) · 1.08 KB
/
ValidationTests.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module ValidationTests exposing (suite)
import Form.Error
import Form.Test
import Form.Test.ValidationExpectation exposing (ValidationExpectation(..))
import Form.Validate
import Model
import Test exposing (..)
suite : Test
suite =
describe "validations"
[ Form.Test.describeValidation "superpower"
Model.validateSuperpower
[ ( "invisible", Valid )
, ( "unvisible", Invalid (Form.Error.CustomError Model.InvalidSuperpower) )
, ( "invisible", ValidDecodesTo Model.Invisible )
, ( "flying", ValidDecodesTo Model.Flying )
]
, Form.Test.describeValidation "email"
Form.Validate.email
[ ( "valid@email.com", Valid )
, ( "This is definitely not an email address", Invalid Form.Error.InvalidEmail )
, ( "stillvalid@withoutTLD", Valid )
]
, Form.Test.describeValidation "naturalInt"
Model.naturalInt
[ ( "123", ValidDecodesTo 123 )
, ( "-123", Invalid (Form.Error.CustomError Model.Nope) )
]
]