1 module Tests.Invoice where
3 import Data.Map.Strict qualified as Map
4 import Data.Text.Lazy qualified as Text.Lazy
5 import Literate.Accounting.Math
6 import Literate.Document.HTML qualified as HTML
7 import Literate.Invoice.HTML qualified as HTML
8 import Literate.Invoice.Invoice
9 import Literate.Prelude
11 import Tests.Entity qualified
12 import Tests.Utils.Tests
13 import Text.Blaze.Renderer.Text qualified as Blaze.Text
14 import Text.Blaze.Renderer.Utf8 qualified as Blaze
15 import Prelude (undefined)
17 spec :: HasCallStack => Spec
19 -- aroundAll readDicts do
21 forM_ (invoices & Map.toList) \(invoiceId, invoice) -> do
22 let idS = invoiceId & HTML.toHtml & Blaze.Text.renderMarkup & Text.Lazy.unpack
23 outPath <- goldenPath idS "html"
25 goldenByteStringBuilderFile outPath do
26 HTML.htmlIO (invoiceId, invoice) <&> Blaze.renderMarkupBuilder
30 [ InvoiceId{invoiceIdBuyer = Tests.Entity.nixosFoundationNGITeam, invoiceIdCount = 1} :=
32 { invoiceCreation = "2025-11-30"
33 , invoiceIssuer = Tests.Entity.julmInfo
34 , invoiceRecipient = Tests.Entity.nixosFoundationNGITeam
35 , invoiceCustomer = Tests.Entity.nixosFoundationNGITeam
36 , invoiceObjet = "Test"
40 { invoiceItemDescription = "Organize work"
41 , invoiceItemRate = 31.25
42 , invoiceItemQuantity = 0.5 + 1 + 1 + 1 + 1 + 1
45 { invoiceItemDescription = "Share knowledge"
46 , invoiceItemRate = 31.25
47 , invoiceItemQuantity = 0.5 + 1 + 2
50 { invoiceItemDescription = "Make a package for Bonfire in NGIpkgs"
51 , invoiceItemRate = 31.25
52 , invoiceItemQuantity = 4 + 8 + 0.1 + 8 + 4 + 6 + 4 + 5 + 6 + 4 + 8 + 8 + 4 + 4 + 4 + 10 + 8
55 { invoiceItemDescription = "Make a service for Bonfire in NGIpkgs"
56 , invoiceItemRate = 31.25
57 , invoiceItemQuantity = 5 + 4 + 8 + 5
60 { invoiceItemDescription = "Make manuals for NGIpkgs"
62 , invoiceItemQuantity = 0.5 + 2 + 4 + 4 + 4 + 8 + 4
68 & Map.fromListWith undefined