btrz-liquid-templates 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-liquid-templates",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Extension and helpers for liquid templates to deal with our data and other things we need to encapsulate",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/barcode.js CHANGED
@@ -14,8 +14,8 @@ function Barcode(engine) {
14
14
  this.content = "not-content-given";
15
15
  this.type = "code128";
16
16
  this.height = 30;
17
- this.width = args[3] || 200;
18
- this.margin = args[4] || "0,0,0,0";
17
+ this.width = 200;
18
+ this.margin = "0,0,0,0";
19
19
  }
20
20
  },
21
21
  render: async function(ctx) {
@@ -0,0 +1,28 @@
1
+ const assert = require("node:assert/strict");
2
+ const {describe, it} = require("node:test");
3
+ const {Barcode} = require("../src/barcode.js");
4
+
5
+ describe("barcode tag parse", () => {
6
+ it("should use safe defaults when args are malformed", () => {
7
+ let barcodeTag;
8
+ const engine = {
9
+ registerTag: (name, tagDefinition) => {
10
+ assert.equal(name, "barcode");
11
+ barcodeTag = tagDefinition;
12
+ }
13
+ };
14
+
15
+ Barcode.call(engine);
16
+
17
+ const parseContext = {};
18
+ assert.doesNotThrow(() => {
19
+ barcodeTag.parse.call(parseContext, {args: {}}, []);
20
+ });
21
+
22
+ assert.equal(parseContext.content, "not-content-given");
23
+ assert.equal(parseContext.type, "code128");
24
+ assert.equal(parseContext.height, 30);
25
+ assert.equal(parseContext.width, 200);
26
+ assert.equal(parseContext.margin, "0,0,0,0");
27
+ });
28
+ });