Skip to content

Commit

Permalink
fix: sequence number
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 14, 2024
1 parent bb5a7ea commit 8583821
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/sequence-number.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const isLetter = input => !/^\d/.test(input)

const getName = input => {
switch (input) {
case 'A':
Expand All @@ -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)
}
Expand Down
4 changes: 4 additions & 0 deletions test/model-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
})
4 changes: 4 additions & 0 deletions test/model-s.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
})
Expand Down
26 changes: 26 additions & 0 deletions test/snapshots/model-3.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Binary file modified test/snapshots/model-3.js.snap
Binary file not shown.
28 changes: 26 additions & 2 deletions test/snapshots/model-s.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Binary file modified test/snapshots/model-s.js.snap
Binary file not shown.

0 comments on commit 8583821

Please sign in to comment.