all repos

onasty @ fdbf2f4dcef1feeba2fe7008940722aee20c2683

a one-time notes service

onasty/web/tests/UnitTests/Data/Note.elm(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module UnitTests.Data.Note exposing (suite)

import Data.Note
import Expect
import Json.Decode as D
import Test exposing (Test, describe, test)


suite : Test
suite =
    describe "Data.Note"
        [ test "decodeCreateResponse"
            (\_ ->
                """ {"slug":"the.note-slug"} """
                    |> D.decodeString Data.Note.decodeCreateResponse
                    |> Expect.ok
            )
        , test "decodeMetadata"
            (\_ ->
                """
                {
                    "created_at": "2023-10-01T12:00:00Z",
                    "has_password": false
                }
                """
                    |> D.decodeString Data.Note.decodeMetadata
                    |> Expect.ok
            )
        ]