Fix test errors
parent
9e761db4f9
commit
b32e0ef123
|
@ -36,7 +36,7 @@ Since the username is safely parsed, one can get these parts of the username.
|
|||
|
||||
-}
|
||||
|
||||
import Internal.Config.Log as Log exposing (log)
|
||||
import Internal.Config.Log exposing (log)
|
||||
import Internal.Grammar.ServerName as ServerName
|
||||
import Internal.Grammar.UserId as UserId
|
||||
import Internal.Tools.Json as Json
|
||||
|
|
|
@ -3,10 +3,13 @@ module Test.Values.Context exposing (..)
|
|||
import Expect
|
||||
import Fuzz exposing (Fuzzer)
|
||||
import Internal.Config.Leaks as Leaks
|
||||
import Internal.Values.Context as Context exposing (Context)
|
||||
import Internal.Tools.Hashdict as Hashdict
|
||||
import Internal.Values.Context as Context exposing (Context, Versions)
|
||||
import Json.Decode as D
|
||||
import Json.Encode as E
|
||||
import Set
|
||||
import Test exposing (..)
|
||||
import Test.Tools.Timestamp as TestTimestamp
|
||||
|
||||
|
||||
fuzzer : Fuzzer Context
|
||||
|
@ -16,14 +19,28 @@ fuzzer =
|
|||
maybeString =
|
||||
Fuzz.maybe Fuzz.string
|
||||
in
|
||||
Fuzz.map7 Context
|
||||
Fuzz.map8 (\a b c d e f ( g, h ) ( i, j ) -> Context a b c d e f g h i j)
|
||||
(Fuzz.constant <| Hashdict.empty .value)
|
||||
maybeString
|
||||
maybeString
|
||||
(Fuzz.maybe TestTimestamp.fuzzer)
|
||||
maybeString
|
||||
maybeString
|
||||
maybeString
|
||||
maybeString
|
||||
(Fuzz.maybe <| Fuzz.list Fuzz.string)
|
||||
(Fuzz.pair
|
||||
Fuzz.string
|
||||
maybeString
|
||||
)
|
||||
(Fuzz.pair
|
||||
maybeString
|
||||
(Fuzz.maybe <| versionsFuzzer)
|
||||
)
|
||||
|
||||
|
||||
versionsFuzzer : Fuzzer Versions
|
||||
versionsFuzzer =
|
||||
Fuzz.map2 Versions
|
||||
(Fuzz.list Fuzz.string)
|
||||
(Fuzz.map Set.fromList <| Fuzz.list Fuzz.string)
|
||||
|
||||
|
||||
{-| If a leak is spotted, make sure to change the leaking value and then test
|
||||
|
@ -64,7 +81,7 @@ leaks =
|
|||
|> Expect.notEqual Leaks.transaction
|
||||
)
|
||||
, fuzz2 fuzzer
|
||||
(Fuzz.list Fuzz.string)
|
||||
versionsFuzzer
|
||||
"Versions"
|
||||
(\context value ->
|
||||
context
|
||||
|
@ -110,7 +127,7 @@ apiContext =
|
|||
|> Expect.equal value
|
||||
)
|
||||
, fuzz2 fuzzer
|
||||
(Fuzz.list Fuzz.string)
|
||||
versionsFuzzer
|
||||
"Versions"
|
||||
(\context value ->
|
||||
context
|
||||
|
@ -126,7 +143,7 @@ json : Test
|
|||
json =
|
||||
describe "JSON encode + JSON decode"
|
||||
[ test "Empty is {}"
|
||||
(Context.init
|
||||
(Context.init ""
|
||||
|> Context.encode
|
||||
|> E.encode 0
|
||||
|> Expect.equal "{}"
|
||||
|
|
|
@ -28,7 +28,7 @@ suite =
|
|||
[ fuzz Fuzz.string
|
||||
"currentVersion"
|
||||
(\s ->
|
||||
s
|
||||
{ content = s, serverName = "" }
|
||||
|> Envelope.init
|
||||
|> Envelope.extractSettings .currentVersion
|
||||
|> Expect.equal Default.currentVersion
|
||||
|
@ -36,7 +36,7 @@ suite =
|
|||
, fuzz Fuzz.string
|
||||
"deviceName"
|
||||
(\s ->
|
||||
s
|
||||
{ content = s, serverName = "" }
|
||||
|> Envelope.init
|
||||
|> Envelope.extractSettings .deviceName
|
||||
|> Expect.equal Default.deviceName
|
||||
|
@ -44,7 +44,7 @@ suite =
|
|||
, fuzz Fuzz.string
|
||||
"syncTime"
|
||||
(\s ->
|
||||
s
|
||||
{ content = s, serverName = "" }
|
||||
|> Envelope.init
|
||||
|> Envelope.extractSettings .syncTime
|
||||
|> Expect.equal Default.syncTime
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
module Test.Values.Room exposing (..)
|
||||
|
||||
import Expect
|
||||
import Fuzz exposing (Fuzzer)
|
||||
import Internal.Values.Room as Room exposing (Room)
|
||||
import Json.Decode as D
|
||||
import Json.Encode as E
|
||||
import Test exposing (..)
|
||||
import Test.Filter.Timeline as TestFilter
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
module Test.Values.User exposing (..)
|
||||
|
||||
import Fuzz exposing (Fuzzer)
|
||||
import Internal.Grammar.ServerName as SN
|
||||
import Internal.Values.User exposing (User)
|
||||
|
||||
|
||||
fuzzer : Fuzzer User
|
||||
fuzzer =
|
||||
Fuzz.constant
|
||||
{ localpart = "temporary"
|
||||
, domain = { host = SN.DNS "matrix.org", port_ = Nothing }
|
||||
}
|
|
@ -7,14 +7,16 @@ import Internal.Values.Vault exposing (Vault)
|
|||
import Test exposing (..)
|
||||
import Test.Tools.Hashdict as TestHashdict
|
||||
import Test.Values.Room as TestRoom
|
||||
import Test.Values.User as TestUser
|
||||
|
||||
|
||||
vault : Fuzzer Vault
|
||||
vault =
|
||||
Fuzz.map2 Vault
|
||||
Fuzz.map3 Vault
|
||||
(Fuzz.string
|
||||
|> Fuzz.map (\k -> ( k, Json.encode Json.int 0 ))
|
||||
|> Fuzz.list
|
||||
|> Fuzz.map Dict.fromList
|
||||
)
|
||||
(TestHashdict.fuzzer .roomId TestRoom.fuzzer)
|
||||
TestUser.fuzzer
|
||||
|
|
Loading…
Reference in New Issue