Refactor test suite

3-event
Bram 2023-12-24 11:30:50 +01:00
parent bf64d5911f
commit fa642b46d6
5 changed files with 63 additions and 54 deletions

View File

@ -0,0 +1,35 @@
module Test.Matrix.Settings exposing (..)
import Expect
import Fuzz
import Matrix.Settings
import Test exposing (..)
import Test.Types as TestTypes
settings : Test
settings =
describe "Exposed Matrix.Settings"
[ describe "Set values"
[ fuzz2 TestTypes.vault
Fuzz.string
"Set device name"
(\vault name ->
vault
|> Matrix.Settings.setDeviceName name
|> Matrix.Settings.getDeviceName
|> Expect.equal name
)
, fuzz2 TestTypes.vault
Fuzz.int
"Set sync time"
(\vault sync ->
vault
|> Matrix.Settings.setSyncTime sync
|> Matrix.Settings.getSyncTime
|> Expect.equal sync
)
]
-- , describe "Read values" []
]

View File

@ -1,4 +1,4 @@
module Iddict exposing (..)
module Test.Tools.Iddict exposing (..)
import Expect
import Fuzz exposing (Fuzzer)

17
tests/Test/Types.elm Normal file
View File

@ -0,0 +1,17 @@
module Test.Types exposing (..)
import Fuzz exposing (Fuzzer)
import Test.Values.Envelope as TestEnvelope
import Test.Values.Event as TestEvent
import Test.Values.Vault as TestVault
import Types exposing (..)
event : Fuzzer Event
event =
Fuzz.map Event (TestEnvelope.fuzzer TestEvent.fuzzer)
vault : Fuzzer Vault
vault =
Fuzz.map Vault (TestEnvelope.fuzzer TestVault.vault)

View File

@ -0,0 +1,10 @@
module Test.Values.Vault exposing (..)
import Fuzz exposing (Fuzzer)
import Internal.Values.Vault exposing (Vault)
import Test exposing (..)
vault : Fuzzer Vault
vault =
Fuzz.unit

View File

@ -1,53 +0,0 @@
module Vault exposing (..)
import Expect
import Fuzz exposing (Fuzzer)
import Internal.Config.Default as Default
import Internal.Values.Envelope as Envelope
import Matrix
import Matrix.Settings
import Test exposing (..)
import Types
fuzzer : Fuzzer Matrix.Vault
fuzzer =
Fuzz.constant <| Types.Vault <| Envelope.init ()
settings : Test
settings =
describe "Edit settings"
[ fuzz fuzzer
"Default device name"
(\vault ->
vault
|> Matrix.Settings.getDeviceName
|> Expect.equal Default.deviceName
)
, fuzz2 fuzzer
Fuzz.string
"Set device name"
(\vault name ->
vault
|> Matrix.Settings.setDeviceName name
|> Matrix.Settings.getDeviceName
|> Expect.equal name
)
, fuzz fuzzer
"Default sync time"
(\vault ->
vault
|> Matrix.Settings.getSyncTime
|> Expect.equal Default.syncTime
)
, fuzz2 fuzzer
Fuzz.int
"Set sync time"
(\vault sync ->
vault
|> Matrix.Settings.setSyncTime sync
|> Matrix.Settings.getSyncTime
|> Expect.equal sync
)
]