Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "btrz-pdf", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Generates pdf documents based on a liquid template", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -131,3 +131,3 @@ const formatter = require("btrz-formatter"); | ||
if (ctx && ctx.environments && ctx.environments.providerPreferences && ctx.environments.providerPreferences.preferences && | ||
ctx.environments[this.item] && ctx.environments[this.item][this.propName]) { | ||
ctx.environments[this.item] && ctx.environments[this.item][this.propName] !== undefined) { | ||
return formatter.money(getCurrencyValue(ctx.environments[this.item], this.propName, ctx.environments.providerPreferences, {prefix: "display"})); | ||
@@ -134,0 +134,0 @@ } |
@@ -132,2 +132,25 @@ describe("index.js", () => { | ||
it("should return money even when values is zero", async () => { | ||
const pdf = require("../src/index"); | ||
const template = `{ | ||
"content": [ | ||
"{%- money ticket total -%}", | ||
"{%- curcySymbol ticket -%}", | ||
"{%- curcyIso ticket -%}", | ||
"{%- moneyReduce ticket ssrs subTotal -%}" | ||
] | ||
}`; | ||
data.ticket.total = 0; | ||
data.ticket.ssrs[0].subTotal = 0; | ||
const documentDefinition = await pdf.toDocumentDefinition(template, data); | ||
expect(documentDefinition).to.be.eql({ | ||
"content": [ | ||
"0.00", | ||
"$", | ||
"CAD", | ||
"31.00", | ||
] | ||
}); | ||
}); | ||
it("should return a parsed liquidTemplate", async () => { | ||
@@ -134,0 +157,0 @@ const pdf = require("../src/index"); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44101
851