Solve elm test bugs from moving user

4-transfer-api
Bram 2024-07-19 09:02:01 +02:00
parent 8b2db7bff6
commit 3566d3ee7a
3 changed files with 12 additions and 10 deletions

View File

@ -8,6 +8,7 @@ import Internal.Values.Context as Context exposing (Context, Versions)
import Set import Set
import Test exposing (..) import Test exposing (..)
import Test.Tools.Timestamp as TestTimestamp import Test.Tools.Timestamp as TestTimestamp
import Test.Values.User as TestUser
fuzzer : Fuzzer Context fuzzer : Fuzzer Context
@ -17,22 +18,25 @@ fuzzer =
maybeString = maybeString =
Fuzz.maybe Fuzz.string Fuzz.maybe Fuzz.string
in in
Fuzz.map8 (\a b c d ( e, f ) ( g, h ) ( i, j ) ( k, l ) -> Context a b c d e f g h i j k l) Fuzz.map8 (\a b c ( d, e ) ( f, g ) ( h, i ) ( j, k ) ( l, m ) -> Context a b c d e f g h i j k l m)
(Fuzz.constant <| Hashdict.empty .value) (Fuzz.constant <| Hashdict.empty .value)
maybeString maybeString
maybeString maybeString
maybeString
(Fuzz.pair (Fuzz.pair
maybeString
(Fuzz.maybe TestTimestamp.fuzzer) (Fuzz.maybe TestTimestamp.fuzzer)
maybeString
) )
(Fuzz.pair (Fuzz.pair
maybeString maybeString
maybeString
)
(Fuzz.pair
Fuzz.string Fuzz.string
maybeString
) )
(Fuzz.pair (Fuzz.pair
maybeString maybeString
maybeString (Fuzz.maybe TestUser.fuzzer)
) )
(Fuzz.pair (Fuzz.pair
maybeString maybeString

View File

@ -25,7 +25,7 @@ suite =
[ fuzz Fuzz.string [ fuzz Fuzz.string
"currentVersion" "currentVersion"
(\s -> (\s ->
{ content = s, serverName = "" } { content = s, serverName = "", user = Nothing }
|> Envelope.init |> Envelope.init
|> Envelope.extractSettings .currentVersion |> Envelope.extractSettings .currentVersion
|> Expect.equal Default.currentVersion |> Expect.equal Default.currentVersion
@ -33,7 +33,7 @@ suite =
, fuzz Fuzz.string , fuzz Fuzz.string
"deviceName" "deviceName"
(\s -> (\s ->
{ content = s, serverName = "" } { content = s, serverName = "", user = Nothing }
|> Envelope.init |> Envelope.init
|> Envelope.extractSettings .deviceName |> Envelope.extractSettings .deviceName
|> Expect.equal Default.deviceName |> Expect.equal Default.deviceName
@ -41,7 +41,7 @@ suite =
, fuzz Fuzz.string , fuzz Fuzz.string
"syncTime" "syncTime"
(\s -> (\s ->
{ content = s, serverName = "" } { content = s, serverName = "", user = Nothing }
|> Envelope.init |> Envelope.init
|> Envelope.extractSettings .syncTime |> Envelope.extractSettings .syncTime
|> Expect.equal Default.syncTime |> Expect.equal Default.syncTime

View File

@ -7,12 +7,11 @@ import Internal.Values.Vault exposing (Vault)
import Test exposing (..) import Test exposing (..)
import Test.Tools.Hashdict as TestHashdict import Test.Tools.Hashdict as TestHashdict
import Test.Values.Room as TestRoom import Test.Values.Room as TestRoom
import Test.Values.User as TestUser
vault : Fuzzer Vault vault : Fuzzer Vault
vault = vault =
Fuzz.map4 Vault Fuzz.map3 Vault
(Fuzz.string (Fuzz.string
|> Fuzz.map (\k -> ( k, Json.encode Json.int 0 )) |> Fuzz.map (\k -> ( k, Json.encode Json.int 0 ))
|> Fuzz.list |> Fuzz.list
@ -20,4 +19,3 @@ vault =
) )
(Fuzz.maybe Fuzz.string) (Fuzz.maybe Fuzz.string)
(TestHashdict.fuzzer .roomId TestRoom.fuzzer) (TestHashdict.fuzzer .roomId TestRoom.fuzzer)
(Fuzz.maybe TestUser.fuzzer)