onasty/web/tests/UnitTests/Data/Note.elm (view raw)
| 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.ok |
| 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.ok |
| 28 | ) |
| 29 | ] |