import { inputValidation } from '../AssetsCardInfo/validation';
import {
  portsIncorrect,
  portsCorrect,
  regexpPorts,
  ipCorrect,
  ipIncorrect,
  regexpIp,
  macIncorrect,
  macCorrect,
} from '../MOCK';

describe('Validation tests', () => {
  portsIncorrect.forEach((item) => {
    test('Fail ports validation', () => {
      return expect(inputValidation(item, regexpPorts)).toBeNull();
    });
  });
  portsCorrect.forEach((item) => {
    test('Sucsess ports validation', () => {
      return expect(inputValidation(item, regexpPorts))[0]?.toEqual(item);
    });
  });
  ipIncorrect.forEach((item) => {
    test('Fail ip validation', () => {
      return expect(inputValidation(item, regexpIp)).toBeNull();
    });
  });
  ipCorrect.forEach((item) => {
    test('Sucsess ip validation', () => {
      return expect(inputValidation(item, regexpIp))[0]?.toEqual(item);
    });
  });
  macIncorrect.forEach((item) => {
    test('Fail mac validation', () => {
      return expect(inputValidation(item, regexpIp)).toBeNull();
    });
  });
  macCorrect.forEach((item) => {
    test('Sucsess mac validation', () => {
      return expect(inputValidation(item, regexpIp))[0]?.toEqual(item);
    });
  });
});
