diff --git a/src/sequence-number.js b/src/sequence-number.js index bd9084e..603e986 100644 --- a/src/sequence-number.js +++ b/src/sequence-number.js @@ -1,3 +1,5 @@ +const isLetter = input => !/^\d/.test(input) + const getName = input => { switch (input) { case 'A': @@ -20,7 +22,7 @@ const getName = input => { module.exports = input => { let name = null - if (Number.isNaN(input[0])) { + if (isLetter(input[0])) { name = getName(input[0]) input = input.slice(1) } diff --git a/test/model-3.js b/test/model-3.js index 5d10c3f..f962c04 100644 --- a/test/model-3.js +++ b/test/model-3.js @@ -23,3 +23,7 @@ test('Tesla Model 3 Long Range AWD 2019', t => { test('Tesla Model 3 Performance 2019', t => { t.snapshot(vinDecoder('5YJ3F7EB3KF438661')) }) + +test('Tesla Model 3 Long Range AWD 2020', t => { + t.snapshot(vinDecoder('5YJ3E1EB7LF788019')) +}) diff --git a/test/model-s.js b/test/model-s.js index 77b90ba..9e7444a 100644 --- a/test/model-s.js +++ b/test/model-s.js @@ -4,6 +4,10 @@ const test = require('ava') const vinDecoder = require('../src') +test('Tesla Model S 85 2012', t => { + t.snapshot(vinDecoder('5YJSA1DN6CFS00937')) +}) + test('Tesla Model S 75D 2018', t => { t.snapshot(vinDecoder('5YJSA7E29JF250011')) }) diff --git a/test/snapshots/model-3.js.md b/test/snapshots/model-3.js.md index 76b3af5..c12d484 100644 --- a/test/snapshots/model-3.js.md +++ b/test/snapshots/model-3.js.md @@ -133,3 +133,29 @@ Generated by [AVA](https://avajs.dev). worldManufacturingIdentifier: 'Fremont, California', year: 2019, } + +## Tesla Model 3 Long Range AWD 2020 + +> Snapshot 1 + + { + bateryType: 'Nickel Manganese Cobalt (NMC)', + bodyType: 'Sedan 4 DR / LHD', + model: 'Tesla Model 3', + motor: 'Dual Motor Standard', + photos: [ + 'https://teslahunt.github.io/tesla-vin/images/3/1.jpeg', + 'https://teslahunt.github.io/tesla-vin/images/3/2.jpeg', + 'https://teslahunt.github.io/tesla-vin/images/3/3.jpeg', + 'https://teslahunt.github.io/tesla-vin/images/3/4.jpeg', + 'https://teslahunt.github.io/tesla-vin/images/3/5.jpeg', + ], + plantOfManufacture: 'Tesla Fremont, California (USA)', + restraintSystems: 'Type 2 Manual seat belts (FR, SR*3) with front Airbags, PODS, side Inflatable restraints, Knee Airbags', + sequenceNumber: { + name: null, + value: 788019, + }, + worldManufacturingIdentifier: 'Fremont, California', + year: 2020, + } diff --git a/test/snapshots/model-3.js.snap b/test/snapshots/model-3.js.snap index 0facfdd..7ed8d59 100644 Binary files a/test/snapshots/model-3.js.snap and b/test/snapshots/model-3.js.snap differ diff --git a/test/snapshots/model-s.js.md b/test/snapshots/model-s.js.md index ab601e5..4aaa731 100644 --- a/test/snapshots/model-s.js.md +++ b/test/snapshots/model-s.js.md @@ -4,6 +4,30 @@ The actual snapshot is saved in `model-s.js.snap`. Generated by [AVA](https://avajs.dev). +## Tesla Model S 85 2012 + +> Snapshot 1 + + { + bateryType: 'Nickel Manganese Cobalt (NMC)', + bodyType: '5 door Hatchback LHD RWD', + model: 'Tesla Model S', + motor: 'Base A/C Motor, Tier 7 battery (81-90 kWh)', + photos: [ + 'https://teslahunt.github.io/tesla-vin/images/S/1.jpeg', + 'https://teslahunt.github.io/tesla-vin/images/S/2.jpeg', + 'https://teslahunt.github.io/tesla-vin/images/S/3.jpeg', + ], + plantOfManufacture: 'Tesla Fremont, California (USA)', + restraintSystems: 'manual Type 2 USA seat belts, dual front airbags, front/rear side airbags, knee airbags', + sequenceNumber: { + name: 'Signature Series', + value: 937, + }, + worldManufacturingIdentifier: 'Fremont, California', + year: 2012, + } + ## Tesla Model S 75D 2018 > Snapshot 1 @@ -46,8 +70,8 @@ Generated by [AVA](https://avajs.dev). plantOfManufacture: 'Tesla Fremont, California (USA)', restraintSystems: 'manual Type 2 USA seat belts, dual front airbags, front/rear side airbags, knee airbags', sequenceNumber: { - name: null, - value: NaN, + name: 'Production', + value: 10148, }, worldManufacturingIdentifier: 'Fremont, California', year: 2013, diff --git a/test/snapshots/model-s.js.snap b/test/snapshots/model-s.js.snap index 2b35a69..715fd0e 100644 Binary files a/test/snapshots/model-s.js.snap and b/test/snapshots/model-s.js.snap differ