text: import CvssVector, { parseVector, V2names, V3names } from './CvssVector';
  import toJson from 'enzyme-to-json';
  
  describe('CvssVector', () => {
      it('Should render without parameters', () => {
          const vector = mount(<CvssVector />);
          expect(toJson(vector)).toMatchSnapshot();
      });
      it('Should render with CVSSv2', () => {
          const vector = mount(<CvssVector cvss2_metrics="AV:L/AC:H/Au:N/C:N/I:N/A:P" />);
          expect(toJson(vector)).toMatchSnapshot();
      });
      it('Should render with CVSSv3', () => {
          const vector = mount(<CvssVector cvss3_metrics="CVSS:3.0/AV:A/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N" />);
          expect(toJson(vector)).toMatchSnapshot();
      });
      it('Should render CVSSv3 when given both', () => {
          const vector = mount(
              <CvssVector cvss2_metrics="AV:L/AC:H/Au:N/C:N/I:N/A:P" cvss3_metrics="CVSS:3.0/AV:A/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N" />
          );
          expect(toJson(vector)).toMatchSnapshot();
      });
      it('Should parse CVSSv2', () => {
          const parsed = parseVector('AV:L/AC:H/Au:N/C:N/I:N/A:P', V2names);
          expect(parsed).toMatchObject({
              'Access vector': 'Local',
              'Access complexity': 'High',
              Authentication: 'None',
              'Confidentiality impact': 'None',
              'Integrity impact': 'None',
              'Availability impact': 'Partial'
          });
      });
      it('Should parse CVSSv3', () => {
          const parsed = parseVector('CVSS:3.0/AV:A/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N', V3names);
          expect(parsed).toMatchObject({
              cvssVersion: 3,
              'Attack vector': 'Adjacent',
              'Attack complexity': 'Low',
              'Privileges required': 'Low',
              'User interaction': 'Required',
              Scope: 'Unchanged',
              Confidentiality: 'Low',
              Integrity: 'None',
              Availability: 'None'
          });
      });
      it('Should parse invalid vector and not fail', () => {
          const parsed = parseVector('CVSS:3.0/AV:A/AC:L/XX:XX', V3names);
          expect(parsed).toMatchObject({ cvssVersion: 3, 'Attack vector': 'Adjacent', 'Attack complexity': 'Low' });
      });
  });
  