From ef8f9ee0cc89f81d1cd06cee4fe2468300f73564 Mon Sep 17 00:00:00 2001 From: singuerinc Date: Mon, 25 Feb 2019 22:27:09 +0100 Subject: [PATCH] fix: isSpecial --- src/isSpecial.js | 2 +- src/specials.js | 2 +- test/isSpecial.test.js | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/isSpecial.js b/src/isSpecial.js index 0a09127..b0c0256 100644 --- a/src/isSpecial.js +++ b/src/isSpecial.js @@ -19,7 +19,7 @@ function isSpecial(value) { return false; } - if (!SPECIALS[code]) { + if (!SPECIALS[code.toUpperCase()]) { return false; } diff --git a/src/specials.js b/src/specials.js index 3b548be..e40fb9c 100644 --- a/src/specials.js +++ b/src/specials.js @@ -14,5 +14,5 @@ export const SPECIALS = { MOP: "Public Works Ministry", PME: "State owned vehicles", PMM: "State owned vehicles, on a Ministry", - Crown: "King's Car" + CROWN: "King's Car" }; diff --git a/test/isSpecial.test.js b/test/isSpecial.test.js index 8b49deb..d4d1e13 100644 --- a/test/isSpecial.test.js +++ b/test/isSpecial.test.js @@ -25,6 +25,14 @@ describe("#isSpecial", () => { assert.equal(isSpecial("Crown 0000"), true); }); + it("should be valid with crown", () => { + assert.equal(isSpecial("crown0001"), true); + }); + + it("should be valid with crown", () => { + assert.equal(isSpecial("crown-0001"), true); + }); + it("should be valid with CME", () => { assert.equal(isSpecial("CME 0001"), true); });