Files
Report-showcase/.template/development/tests/domain/profiles.typ
T
2026-10-09 01:45:17 +00:00

59 lines
1.9 KiB
Typst
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#import "/.template/lib/domain/parties.typ": recipient, party, signer
#import "/.template/lib/presentation/profiles/index.typ" as profiles
#import "/.template/lib/shared/numbering.typ": attachment_numbering
#let run() = {
let addressee = recipient(company: "ООО «Адресат»")
let report = profiles.report(
title: "Проверка отчёта",
show_title_page: false,
show_executors: false,
show_outline: true,
)
let report-metadata = (report.validate)(report.metadata)
assert.eq(report.id, "report")
assert.eq(report-metadata.at("show-title-page"), false)
assert.eq(report-metadata.at("show-executors"), false)
assert.eq(report-metadata.at("show-outline"), true)
let letter = profiles.letter(recipient: addressee)
assert.eq(letter.id, "letter")
assert.eq(((letter.validate)(letter.metadata)).recipient.kind, "recipient")
let offer = profiles.commercial_offer(
recipient: addressee,
subject: "Предмет",
amount: "100",
)
assert.eq(offer.id, "commercial-offer")
assert.eq(((offer.validate)(offer.metadata)).terms.amount, "100")
let left = party(
"left",
"Исполнитель",
"ООО «Исполнитель»",
representative: signer("И.И. Исполнитель", "Директор"),
)
let right = party(
"right",
"Заказчик",
"ООО «Заказчик»",
representative: signer("З.З. Заказчик", "Директор"),
)
let contract = profiles.contract(
number: "1",
parties: (left, right),
sections: (
profiles.contract_section("subject", "Предмет", [Текст раздела]),
),
)
assert.eq(contract.id, "contract")
assert.eq(((contract.validate)(contract.metadata)).sections.len(), 1)
assert.eq(attachment_numbering("arabic", 2), "2")
assert.eq(attachment_numbering("cyrillic", 2), "Б")
assert.eq(attachment_numbering("none", 2), "")
"ok"
}