Remove test issues & warnings

pull/34/head
Bram 2024-07-16 10:20:38 +02:00
parent a401c25a47
commit 20504d4a8b
9 changed files with 34 additions and 28 deletions

View File

@ -71,7 +71,6 @@ import Internal.Config.Text as Text
import Internal.Tools.Hashdict as Hashdict exposing (Hashdict) import Internal.Tools.Hashdict as Hashdict exposing (Hashdict)
import Internal.Tools.Json as Json import Internal.Tools.Json as Json
import Internal.Tools.Timestamp as Timestamp exposing (Timestamp) import Internal.Tools.Timestamp as Timestamp exposing (Timestamp)
import Json.Encode as E
import Set exposing (Set) import Set exposing (Set)
import Time import Time

View File

@ -58,7 +58,6 @@ import Internal.Values.Event as Event exposing (Event)
import Internal.Values.StateManager as StateManager exposing (StateManager) import Internal.Values.StateManager as StateManager exposing (StateManager)
import Internal.Values.Timeline as Timeline exposing (Timeline) import Internal.Values.Timeline as Timeline exposing (Timeline)
import Internal.Values.User exposing (User) import Internal.Values.User exposing (User)
import Json.Encode as E
import Recursion import Recursion
import Recursion.Fold import Recursion.Fold

View File

@ -678,20 +678,21 @@ mostRecentFrom filter timeline ptr =
{ ptr = ptr, visited = Set.empty } { ptr = ptr, visited = Set.empty }
{-| Recount the Timeline's amount of filled batches. Since the Timeline
automatically tracks the count on itself, this is generally exclusively used in -- {-| Recount the Timeline's amount of filled batches. Since the Timeline
specific scenarios like decoding JSON values. -- automatically tracks the count on itself, this is generally exclusively used in
-} -- specific scenarios like decoding JSON values.
recountFilledBatches : Timeline -> Timeline -- -}
recountFilledBatches (Timeline tl) = -- recountFilledBatches : Timeline -> Timeline
Timeline -- recountFilledBatches (Timeline tl) =
{ tl -- Timeline
| filledBatches = -- { tl
tl.batches -- | filledBatches =
|> Iddict.values -- tl.batches
|> List.filter (\v -> v.events /= []) -- |> Iddict.values
|> List.length -- |> List.filter (\v -> v.events /= [])
} -- |> List.length
-- }
{-| Create a timeline with a single batch inserted. This batch is considered the {-| Create a timeline with a single batch inserted. This batch is considered the

View File

@ -3,6 +3,7 @@ module Internal.Values.Vault exposing
, VaultUpdate(..), update , VaultUpdate(..), update
, rooms, fromRoomId, mapRoom, updateRoom , rooms, fromRoomId, mapRoom, updateRoom
, getAccountData, setAccountData , getAccountData, setAccountData
, coder
) )
{-| This module hosts the Vault module. The Vault is the data type storing all {-| This module hosts the Vault module. The Vault is the data type storing all
@ -30,6 +31,11 @@ Rooms are environments where people can have a conversation with each other.
@docs getAccountData, setAccountData @docs getAccountData, setAccountData
## JSON
@docs coder
-} -}
import FastDict as Dict exposing (Dict) import FastDict as Dict exposing (Dict)
@ -65,6 +71,8 @@ type VaultUpdate
| SetUser User | SetUser User
{-| Convert a Vault to and from a JSON object.
-}
coder : Json.Coder Vault coder : Json.Coder Vault
coder = coder =
Json.object4 Json.object4

View File

@ -5,8 +5,6 @@ import Fuzz exposing (Fuzzer)
import Internal.Config.Leaks as Leaks import Internal.Config.Leaks as Leaks
import Internal.Tools.Hashdict as Hashdict import Internal.Tools.Hashdict as Hashdict
import Internal.Values.Context as Context exposing (Context, Versions) import Internal.Values.Context as Context exposing (Context, Versions)
import Json.Decode as D
import Json.Encode as E
import Set import Set
import Test exposing (..) import Test exposing (..)
import Test.Tools.Timestamp as TestTimestamp import Test.Tools.Timestamp as TestTimestamp
@ -19,12 +17,15 @@ 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 ) -> Context a b c d e f g h i j k) 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.constant <| Hashdict.empty .value) (Fuzz.constant <| Hashdict.empty .value)
maybeString maybeString
maybeString maybeString
maybeString
(Fuzz.pair
(Fuzz.maybe TestTimestamp.fuzzer) (Fuzz.maybe TestTimestamp.fuzzer)
maybeString maybeString
)
(Fuzz.pair (Fuzz.pair
maybeString maybeString
Fuzz.string Fuzz.string

View File

@ -3,10 +3,7 @@ module Test.Values.Envelope exposing (..)
import Expect import Expect
import Fuzz exposing (Fuzzer) import Fuzz exposing (Fuzzer)
import Internal.Config.Default as Default import Internal.Config.Default as Default
import Internal.Tools.Json as Json
import Internal.Values.Envelope as Envelope exposing (Envelope) import Internal.Values.Envelope as Envelope exposing (Envelope)
import Json.Decode as D
import Json.Encode as E
import Test exposing (..) import Test exposing (..)
import Test.Values.Context as TestContext import Test.Values.Context as TestContext
import Test.Values.Settings as TestSettings import Test.Values.Settings as TestSettings

View File

@ -41,16 +41,18 @@ fuzzerState =
unsignedDataFuzzer : Fuzzer Event.UnsignedData unsignedDataFuzzer : Fuzzer Event.UnsignedData
unsignedDataFuzzer = unsignedDataFuzzer =
Fuzz.map4 Fuzz.map5
(\age prev redact trans -> (\age memb prev redact trans ->
Event.UnsignedData Event.UnsignedData
{ age = age { age = age
, membership = memb
, prevContent = prev , prevContent = prev
, redactedBecause = redact , redactedBecause = redact
, transactionId = trans , transactionId = trans
} }
) )
(Fuzz.maybe Fuzz.int) (Fuzz.maybe Fuzz.int)
(Fuzz.maybe Fuzz.string)
(Fuzz.maybe valueFuzzer) (Fuzz.maybe valueFuzzer)
(Fuzz.maybe <| Fuzz.lazy (\_ -> fuzzer)) (Fuzz.maybe <| Fuzz.lazy (\_ -> fuzzer))
(Fuzz.maybe Fuzz.string) (Fuzz.maybe Fuzz.string)

View File

@ -4,8 +4,6 @@ import Fuzz exposing (Fuzzer)
import Internal.Values.Room as Room exposing (Room) import Internal.Values.Room as Room exposing (Room)
import Json.Encode as E import Json.Encode as E
import Test exposing (..) import Test exposing (..)
import Test.Filter.Timeline as TestFilter
import Test.Values.Event as TestEvent
placeholderValue : E.Value placeholderValue : E.Value

View File

@ -11,7 +11,7 @@ import Test exposing (..)
fuzzer : Fuzzer Settings fuzzer : Fuzzer Settings
fuzzer = fuzzer =
Fuzz.map4 Settings Fuzz.map5 Settings
(Fuzz.oneOf (Fuzz.oneOf
[ Fuzz.constant Default.currentVersion [ Fuzz.constant Default.currentVersion
, Fuzz.string , Fuzz.string
@ -22,6 +22,7 @@ fuzzer =
, Fuzz.string , Fuzz.string
] ]
) )
(Fuzz.maybe Fuzz.string)
(Fuzz.oneOf (Fuzz.oneOf
[ Fuzz.constant Default.removePasswordOnLogin [ Fuzz.constant Default.removePasswordOnLogin
, Fuzz.bool , Fuzz.bool