Initial commit

This commit is contained in:
malysheva committed 2026-10-09 04:24:38 +00:00
commit c534d5ce80
163 files changed
+11500

No files matched your search

@@ -0,0 +1,67 @@
#import "/.template/lib/domain/document.typ": render-options, document-profile, validate-profile-contract
#import "/.template/lib/domain/attachments.typ": attachment, attachment-set
#import "/.template/lib/domain/references.typ": bibliography-section, validate-bibliographies
#import "/.template/lib/infrastructure/company-assets.typ": load-company, available-companies
#import "/.template/lib/infrastructure/employees.typ": employee-directory, empty-private-settings, private-company-media, report-executor
#let passthrough(body, ctx) = body
#let run() = {
let options = render-options()
assert.eq(options.mode, "final")
assert.eq(options.at("media-policy"), "placeholder")
let profile = document-profile("unit", passthrough)
assert.eq(validate-profile-contract(profile).id, "unit")
assert.eq(available-companies().len(), 4)
for id in available-companies() {
let loaded = load-company(id)
assert.eq(loaded.kind, "company-profile")
assert(type(loaded.legal.name) == str)
}
let company = load-company("test-company")
assert.eq(company.legal.name, "ООО «Тестовая компания»")
assert.eq(type(company.resources.logo), path)
assert.eq(employee-directory.len(), 19)
let unsigned = report-executor("fedorov")
assert.eq(unsigned.at(1), "Федоров Д.А.")
assert.eq(unsigned.at(2), none)
let private-settings = (
companies: (scientia: (signature: true, stamp: false)),
signatures: (
musikhin: (enabled: true, offset: 1.25cm),
fedorov: (enabled: false, offset: 0.7cm),
),
)
let signed = report-executor(
"musikhin",
role: "Управляющий директор",
private-settings: private-settings,
)
assert.eq(signed.at(0), "Управляющий директор")
assert.eq(type(signed.at(2)), path)
assert.eq(signed.at(3), 1.25cm)
assert.eq(report-executor("fedorov", private-settings: private-settings).at(2), none)
let media = private-company-media(private-settings, "scientia")
assert.eq(type(media.signature), path)
assert.eq(media.stamp, none)
assert.eq(private-company-media(empty-private-settings, "scientia").signature, none)
let item = attachment("a", "Приложение", [Текст])
let items = attachment-set(items: (item,), numbering: "cyrillic")
assert.eq(items.items.len(), 1)
let bibliography = bibliography-section("main", path("/assets/references.bib"))
assert.eq(validate-bibliographies((bibliography,)).len(), 1)
assert.eq(bibliography.at("page-break"), true)
let compact-bibliography = bibliography-section(
"compact",
path("/assets/references.bib"),
page_break: false,
)
assert.eq(compact-bibliography.at("page-break"), false)
"ok"
}
@@ -0,0 +1,12 @@
#import "/.template/lib/numbering.typ": cyrillic_numbering, num_11, num_1a, num_1_a
#let run() = {
assert.eq(cyrillic_numbering(1), "А")
assert.eq(cyrillic_numbering(8), "И")
assert.eq(cyrillic_numbering(25), "Я")
assert.eq(cyrillic_numbering(26), "26")
assert.eq(num_11(1, 2, 3), "1.2.3.")
assert.eq(num_1a(1, 2, 3), "1.б.3.")
assert.eq(num_1_a(1, 2), "б.")
"ok"
}
@@ -0,0 +1,58 @@
#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"
}