From fb61f08691d4809d4bb347914e89bc57fab3d793 Mon Sep 17 00:00:00 2001 From: alexandercerutti Date: Wed, 12 Sep 2018 00:58:39 +0200 Subject: [PATCH] Added barcode().backward() tests --- tests/index.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/index.js b/tests/index.js index 5783207..b46e62b 100644 --- a/tests/index.js +++ b/tests/index.js @@ -222,6 +222,33 @@ describe("Node-Passkit-generator", function() { expect(pass.props["barcode"] instanceof Object).toBe(true); expect(pass.props["barcodes"].length).toBe(1); expect(pass.props["barcodes"][0] instanceof Object).toBe(true); - }) + }); + }); + + describe("barcode().backward()", () => { + it("Passing argument of type different from string or null, won't apply changes", function() { + pass + .barcode("Message-22645272183") + .backward(5); + + // unchanged + expect(pass.props["barcode"].format).toBe("PKBarcodeFormatQR"); + }); + + it("Null will delete backward support", () => { + pass + .barcode("Message-22645272183") + .backward(null); + + expect(pass.props["barcode"]).toBe(undefined); + }); + + it("Unknown format won't apply changes", () => { + pass + .barcode("Message-22645272183") + .backward("PKBingoBongoFormat"); + + expect(pass.props["barcode"].format).toBe("PKBarcodeFormatQR"); + }); }); });