Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
BigThunderSR committed Apr 15, 2024
1 parent 74dbda7 commit 9df7d6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for (let prop in onstarRequiredProperties) {

// Validate VIN
if (!/^[A-HJ-NPR-Z0-9]{17}$/i.test(onstarConfig.vin)) {
throw new Error('Invalid VIN. Please check the value entered for VIN.');
throw new Error('Invalid VIN. Please check the value entered for VIN in ONSTAR_VIN.');
}

// Validate PIN
Expand Down
8 changes: 4 additions & 4 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ describe('OnstarConfig', function() {
const onstarConfig = {vin: ' 1HGCM82633A123456', onStarPin: '1234'};
try {
if (!/^[A-HJ-NPR-Z0-9]{17}$/i.test(onstarConfig.vin)) {
throw new Error('Invalid VIN. Please check the value entered for VIN.');
throw new Error('Invalid VIN. Please check the value entered for VIN in ONSTAR_VIN.');
}
// If no error is thrown, then the test will fail
assert.fail('Expected an error to be thrown');
} catch (e) {
assert.equal(e.message, 'Invalid VIN. Please check the value entered for VIN.');
assert.equal(e.message, 'Invalid VIN. Please check the value entered for VIN in ONSTAR_VIN.');
}
});

it('should throw error for invalid VIN', function() {
const onstarConfig = {vin: '1GCM2633A123456', onStarPin: '1234'};
try {
if (!/^[A-HJ-NPR-Z0-9]{17}$/i.test(onstarConfig.vin)) {
throw new Error('Invalid VIN. Please check the value entered for VIN.');
throw new Error('Invalid VIN. Please check the value entered for VIN in ONSTAR_VIN.');
}
// If no error is thrown, then the test will fail
assert.fail('Expected an error to be thrown');
} catch (e) {
assert.equal(e.message, 'Invalid VIN. Please check the value entered for VIN.');
assert.equal(e.message, 'Invalid VIN. Please check the value entered for VIN in ONSTAR_VIN.');
}
});

Expand Down

0 comments on commit 9df7d6a

Please sign in to comment.