From 2c97274acd77ef9192671a43c8b9e9a6816fe9f0 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Sat, 30 Mar 2019 21:33:56 +0100 Subject: [PATCH] Moved tests to spec folder with jasmine configuration --- package.json | 2 +- {tests => spec}/index.js | 0 spec/support/jasmine.json | 6 ++++++ src/pass.js | 9 +++++---- 4 files changed, 12 insertions(+), 5 deletions(-) rename {tests => spec}/index.js (100%) create mode 100644 spec/support/jasmine.json diff --git a/package.json b/package.json index 0deadeb..e945147 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "The easiest way to generate custom Apple Wallet passes in Node.js", "main": "index.js", "scripts": { - "test": "jasmine tests/index.js" + "test": "jasmine spec/index.js" }, "author": "Alexander Patrick Cerutti", "license": "MIT", diff --git a/tests/index.js b/spec/index.js similarity index 100% rename from tests/index.js rename to spec/index.js diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json new file mode 100644 index 0000000..04f7d03 --- /dev/null +++ b/spec/support/jasmine.json @@ -0,0 +1,6 @@ +{ + "spec_dir": "spec", + "spec_files": [ "**/index.js" ], + "stopSpecOnExpectationFailure": false, + "random": true +} diff --git a/src/pass.js b/src/pass.js index e2cf28d..efc259d 100644 --- a/src/pass.js +++ b/src/pass.js @@ -20,6 +20,7 @@ const readdir = promisify(fs.readdir); const readFile = promisify(fs.readFile); const noop = () => { }; +const transitType = Symbol("transitType"); class Pass { constructor(options) { @@ -38,7 +39,7 @@ class Pass { this._fields = ["primaryFields", "secondaryFields", "auxiliaryFields", "backFields", "headerFields"]; this._fields.forEach(a => this[a] = new FieldsArray()); - this._transitType = ""; + this[transitType] = ""; // Assigning model and _props to this Object.assign(this, this._parseSettings(options)); @@ -692,15 +693,15 @@ class Pass { set transitType(v) { if (schema.isValid(v, "transitType")) { - this._transitType = v; + this[transitType] = v; } else { genericDebug(formatMessage("TRSTYPE_NOT_VALID", v)); - this._transitType = this._transitType || ""; + this[transitType] = this[transitType] || ""; } } get transitType() { - return this._transitType; + return this[transitType]; } }