21 lines
1.4 KiB
Nim
21 lines
1.4 KiB
Nim
import std/json, std/times, std/unittest
|
|
|
|
import hff_entry_forms_apipkg/models
|
|
|
|
suite "models":
|
|
|
|
test "asNotionPage(EventProposal)":
|
|
let ep = EventProposal(
|
|
name: "Test Event",
|
|
description: "A test event.",
|
|
purpose: "Event example for unit testing.",
|
|
department: "Testing",
|
|
location: "Hope Family Fellowship",
|
|
owner: "Jonathan Bernard",
|
|
date: parse("2021-10-30", "YYYY-MM-dd"),
|
|
budgetInDollars: 56)
|
|
|
|
let expectedJson = """{"properties":{"Event":{"title":[{"type":"text","text":{"content":"Test Event"}}]},"Date":{"date":{"start":"2021-10-30T00:00:00.000-05:00"}},"Department":{"multi_select":[{"name":"Testing"}]},"Location":{"rich_text":[{"type":"text","text":{"content":"Hope Family Fellowship"}}]},"Owner":{"rich_text":[{"type":"text","text":{"content":"Jonathan Bernard"}}]},"State":{"select":{"name":"Proposed"}}},"children":[{"object":"block","type":"heading_2","heading_2":{"text":[{"type":"text","text":{"content":"Purpose"}}]}},{"object":"block","type":"paragraph","paragraph":{"text":[{"type":"text","text":{"content":"Event example for unit testing."}}]}},{"object":"block","type":"heading_2","heading_2":{"text":[{"type":"text","text":{"content":"Description"}}]}},{"object":"block","type":"paragraph","paragraph":{"text":[{"type":"text","text":{"content":"A test event."}}]}}]}"""
|
|
|
|
check $(ep.asNotionPage) == expectedJson
|