all repos

onasty @ 62e4dde75f5cca100c807673176826e5f120c86d

a one-time notes service

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

Smirnov Olexandr Smirnov Olexandr
ss2316544@gmail.com
web: show note (#147)..., 11 months ago
1
module UnitTests.Data.Note exposing (suite)
2
3
import Data.Note
4
import Expect
5
import Json.Decode as D
6
import Test exposing (Test, describe, test)
7
8
9
suite : Test
10
suite =
11
    describe "Data.Note"
12
        [ test "decodeCreateResponse"
13
            (\_ ->
14
                "{\"slug\":\"the.note-slug\"}"
15
                    |> D.decodeString Data.Note.decodeCreateResponse
16
                    |> Expect.equal (Ok { slug = "the.note-slug" })
17
            )
18
        , test "decodeMetadata"
19
            (\_ ->
20
                """
21
                    {
22
                        "created_at": "2023-10-01T12:00:00Z",
23
                        "has_password": false
24
                    }
25
                    """
26
                    |> D.decodeString Data.Note.decodeMetadata
27
                    |> Expect.equal (Ok { createdAt = "2023-10-01T12:00:00Z", hasPassword = False })
28
            )
29
        ]