#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(), 9) 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" }