module Tests.Invoice where import Data.Map.Strict qualified as Map import Data.Text.Lazy qualified as Text.Lazy import Literate.Accounting.Math import Literate.Document.HTML qualified as HTML import Literate.Invoice.HTML qualified as HTML import Literate.Invoice.Invoice import Literate.Prelude import Test.Syd import Tests.Entity qualified import Tests.Utils.Tests import Text.Blaze.Renderer.Text qualified as Blaze.Text import Text.Blaze.Renderer.Utf8 qualified as Blaze import Prelude (undefined) spec :: HasCallStack => Spec spec = -- aroundAll readDicts do describe "Invoice" do forM_ (invoices & Map.toList) \(invoiceId, invoice) -> do let idS = invoiceId & HTML.toHtml & Blaze.Text.renderMarkup & Text.Lazy.unpack outPath <- goldenPath idS "html" it idS do goldenByteStringBuilderFile outPath do HTML.htmlIO (invoiceId, invoice) <&> Blaze.renderMarkupBuilder invoices :: Invoices invoices = [ InvoiceId{invoiceIdBuyer = Tests.Entity.nixosFoundationNGITeam, invoiceIdCount = 1} := Invoice { invoiceCreation = "2025-11-30" , invoiceIssuer = Tests.Entity.julmInfo , invoiceRecipient = Tests.Entity.nixosFoundationNGITeam , invoiceCustomer = Tests.Entity.nixosFoundationNGITeam , invoiceObjet = "Test" , invoiceDetails = "" , invoiceItems = [ InvoiceItem { invoiceItemDescription = "Organize work" , invoiceItemRate = 31.25 , invoiceItemQuantity = 0.5 + 1 + 1 + 1 + 1 + 1 } , InvoiceItem { invoiceItemDescription = "Share knowledge" , invoiceItemRate = 31.25 , invoiceItemQuantity = 0.5 + 1 + 2 } , InvoiceItem { invoiceItemDescription = "Make a package for Bonfire in NGIpkgs" , invoiceItemRate = 31.25 , invoiceItemQuantity = 4 + 8 + 0.1 + 8 + 4 + 6 + 4 + 5 + 6 + 4 + 8 + 8 + 4 + 4 + 4 + 10 + 8 } , InvoiceItem { invoiceItemDescription = "Make a service for Bonfire in NGIpkgs" , invoiceItemRate = 31.25 , invoiceItemQuantity = 5 + 4 + 8 + 5 } , InvoiceItem { invoiceItemDescription = "Make manuals for NGIpkgs" , invoiceItemRate = 0 , invoiceItemQuantity = 0.5 + 2 + 4 + 4 + 4 + 8 + 4 } ] , invoiceRate = 0 } ] & Map.fromListWith undefined