import { VIN_INFORMATION } from "@boldpenguin/sdk-types";
import { VehicleVinService } from "./vehicle-vin.service";
describe('VehicleVinService', () => {
    describe('isValidVin()', () => {
        const invalidVin = 'KMHCM46C88U271704';
        it.each(['1FAFP40634F172825', '5N1AR1NN6CC627773', '1LNHM82V17Y620829', 'JH4KA7650NC040097', '1GNDM19ZXRB170064', '5J6HYJ8V55L009357'])('given valid VIN: "%s", should return true', (vin) => {
            const isValid = VehicleVinService.isValidVin(vin);
            expect(isValid).toEqual(true);
        });
        it.each([undefined, null, '', invalidVin])('given invalid VIN: "%s", should return false', (vin) => {
            const isValid = VehicleVinService.isValidVin(vin);
            expect(isValid).toEqual(false);
        });
    });
    describe('hasValidLength()', () => {
        it('given a VIN with the correct length, should return true', () => {
            const vinWithValidLength = '1'.repeat(VehicleVinService.VALID_VIN_LENGTH);
            const isValid = VehicleVinService.hasValidLength(vinWithValidLength);
            expect(isValid).toEqual(true);
        });
        it.each([undefined, null, '', '1'.repeat(VehicleVinService.VALID_VIN_LENGTH - 1)])('given VIN with invalid length: "%s", should return false', (vin) => {
            const isValid = VehicleVinService.hasValidLength(vin);
            expect(isValid).toEqual(false);
        });
    });
    describe('getValidationErrorMessage()', () => {
        it('given a valid VIN, returns undefined', () => {
            const errorMessage = VehicleVinService.getValidationErrorMessage('1FAFP40634F172825');
            expect(errorMessage).toBeUndefined();
        });
        it('given an invalid VIN, returns an error message', () => {
            const errorMessage = VehicleVinService.getValidationErrorMessage('');
            expect(errorMessage).toEqual(VIN_INFORMATION.messages.invalid);
        });
    });
});
