Sha256: bfa5fd9cf4f228f682135f5134975ff864f8b0896811aa2f938aba593cdfd7a5

Contents?: true

Size: 1.84 KB

Versions: 114

Compression:

Stored size: 1.84 KB

Contents

module Tests exposing (..)

import Test exposing (..)
import Expect
import PhoneNumber exposing (getNumber, prettyPrint)


tests : Test
tests =
    describe "PhoneNumber"
        [ test "cleans number" <|
            \() -> Expect.equal (Just "1234567890") (getNumber "(123) 456-7890")
        , skip <|
            test "cleans number with dots" <|
                \() -> Expect.equal (Just "1234567890") (getNumber "123.456.7890")
        , skip <|
            test "valid when 11 digits and first is 1" <|
                \() -> Expect.equal (Just "1234567890") (getNumber "11234567890")
        , skip <|
            test "invalid when 11 digits" <|
                \() -> Expect.equal Nothing (getNumber "21234567890")
        , skip <|
            test "invalid when 9 digits" <|
                \() -> Expect.equal Nothing (getNumber "123456789")
        , skip <|
            test "invalid when 12 digits" <|
                \() -> Expect.equal Nothing (getNumber "123456789012")
        , skip <|
            test "invalid when empty" <|
                \() -> Expect.equal Nothing (getNumber "")
        , skip <|
            test "invalid when no digits present" <|
                \() -> Expect.equal Nothing (getNumber " (-) ")
        , skip <|
            test "valid with leading characters" <|
                \() -> Expect.equal (Just "1234567890") (getNumber "my number is 123 456 7890")
        , skip <|
            test "valid with trailing characters" <|
                \() -> Expect.equal (Just "1234567890") (getNumber "123 456 7890 - bob")
        , skip <|
            test "pretty print" <|
                \() -> Expect.equal (Just "(123) 456-7890") (prettyPrint "1234567890")
        , skip <|
            test "pretty print with full us phone number" <|
                \() -> Expect.equal (Just "(123) 456-7890") (prettyPrint "11234567890")
        ]

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
trackler-2.2.1.104 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.103 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.102 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.101 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.100 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.99 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.98 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.97 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.96 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.95 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.94 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.93 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.92 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.91 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.90 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.89 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.88 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.87 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.86 tracks/elm/exercises/phone-number/tests/Tests.elm
trackler-2.2.1.85 tracks/elm/exercises/phone-number/tests/Tests.elm