Files
jquery-validation-mirror/test/additional/vinUS.js
Warren White 13b859e357 Additional: vinUS validation fails on valid vin numbers (#2460)
* Removed === compare, changed to ==
Compare by value and type (===) does not work for this algorithm, as both cd and cdv can be either types at the same time.
By comparing by value only (==) cd and cdv can be either integer or string, as a string number will be converted to a number reqardless of type.

* Rewrote forloop, removed nested forloop

* Additional: fixed spacing issues

* Additional: Add vinUS.js validation test cases

Test cases include default test with 17 one's, and additional US and Canada VIN

* Additional: add two more test casses for vinUS

* Additional: removed text license number, should be VIN
2022-12-01 10:50:24 +00:00

12 lines
641 B
JavaScript

QUnit.test( "vinUS", function( assert ) {
var method = methodTest( "vinUS" );
assert.ok( method( "11111111111111111" ), "Valid test VIN number" );
assert.ok( method( "1FTFX1CT9CFD06231" ), "Valid US VIN number" );
assert.ok( method( "2FTHF26F8SCA68695" ), "Valid CAN VIN number" );
assert.ok( method( "LJCPCBLCX11000237" ), "Valid VIN with X check digit" );
assert.ok( !method( "LJCPCBLC011000237" ), "Invalid VIN with 0 check digit" );
assert.ok( !method( "2FTHF26F8" ), "InValid VIN number" );
assert.ok( !method( "11111111X1111111" ), "Invalid test VIN" );
assert.ok( !method( "1111111101111111" ), "Invalid test VIN" );
} );