From 8583821d2ef43fb63bf69661dc3ca708f7894aa6 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Fri, 14 Jun 2024 13:39:55 +0200 Subject: [PATCH] fix: sequence number --- src/sequence-number.js | 4 +++- test/model-3.js | 4 ++++ test/model-s.js | 4 ++++ test/snapshots/model-3.js.md | 26 ++++++++++++++++++++++++++ test/snapshots/model-3.js.snap | Bin 949 -> 1023 bytes test/snapshots/model-s.js.md | 28 ++++++++++++++++++++++++++-- test/snapshots/model-s.js.snap | Bin 852 -> 921 bytes 7 files changed, 63 insertions(+), 3 deletions(-) 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 0facfdd72eee89fe86535629f76d9f9f4f01e680..7ed8d59dff786eb214aee13119cc2635e0165bfc 100644 GIT binary patch literal 1023 zcmV{(6%tZ_sVY!{LY&$yDo6-fu?mGc z33e(#oMydad)oD^*%_x;0wg2|2c$}f9xCNjxNw9M2QC}|35g3wE(LMwty~Zn*f{I5 zZi?He6h~U0c4udv=DnTy5W(nzEX0ut4DUeB!8O#!TgfNh?!(`GGR)*b;Zd=ApkF2WN z1?ls$&<&xbk$fd^g>U)%YI$X0VElv|c!|;3s`P~BCwQsCbG-6mX<)!uD=J2OHcK;t`p4Gq8afi27jL7uv4X%R+bR zqGmf`f9{XrLmz<+E%;9%9e>Ayb=|J=c5XC zgwKr>)|I|BeExK0kyk5E78dwLWt+Sn2HNtX3SH4Ki`*zr@-w>b3oBe-@_u}?liRod z$ZgulH#<_-^Dq45r*zJ zOd%15?KjMcL>OnkVNULbnF67MuUd;%ZzHg&!F{+X{7&zg!@gpZv2Jro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xB}-Ae>`jQ}4JB(uaZ3y>41-9Pxhy4XzQ$Xd5^-fvCNk^M*{>Gxn+4P;Fr>h@6qw%2vUMBSvVpL$?4Vor+y~RCWiMnc+Z2%(Mt!cjqJXS` XtbnY5Y?2|n@m1+h=4({&Qy2gMPF2xk 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 2b35a69a494419ff8df318a1fffda11800cac503..715fd0e30501c96d068cef215144a3eadba370a7 100644 GIT binary patch literal 921 zcmV;K17`d|RzVaO z?)&b$zkTj>+#qcCq7OcoR@p$t2Qmr-H9}7Y)S`_VRo2!kD$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