Skip to content

Commit

Permalink
test: getNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
singuerinc committed Feb 25, 2019
1 parent 4708aa1 commit 857facd
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions test/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ describe("#parse", () => {
});

describe("valid", () => {
describe("special with zero", () => {
it("parse", () => {
assert.deepStrictEqual(parse("Crown 0001"), {
isSpecial: true,
isOld: false,
specialCode: "CROWN",
specialName: "King's Car",
provinceCode: null,
provinceName: null,
number: "0001",
counter: null
});
});
});

describe("special", () => {
it("parse", () => {
assert.deepStrictEqual(parse("DGP 1234"), {
Expand All @@ -30,7 +45,7 @@ describe("#parse", () => {
specialName: "Spanish Police",
provinceCode: null,
provinceName: null,
number: 1234,
number: "1234",
counter: null
});
});
Expand All @@ -45,7 +60,22 @@ describe("#parse", () => {
specialName: null,
provinceCode: "GI",
provinceName: "Province of Girona",
number: 2345,
number: "2345",
counter: "BC"
});
});
});

describe("old with zero", () => {
it("parse", () => {
assert.deepStrictEqual(parse("GI 0123 BC"), {
isSpecial: false,
isOld: true,
specialCode: null,
specialName: null,
provinceCode: "GI",
provinceName: "Province of Girona",
number: "0123",
counter: "BC"
});
});
Expand All @@ -60,7 +90,22 @@ describe("#parse", () => {
specialName: null,
provinceCode: null,
provinceName: null,
number: 2345,
number: "2345",
counter: "GBC"
});
});
});

describe("new with zero", () => {
it("parse", () => {
assert.deepStrictEqual(parse("0345GBC"), {
isSpecial: false,
isOld: false,
specialCode: null,
specialName: null,
provinceCode: null,
provinceName: null,
number: "0345",
counter: "GBC"
});
});
Expand Down

0 comments on commit 857facd

Please sign in to comment.