import React from 'react';
import { shallow } from 'enzyme';
import SelectType from '../types/Select';

describe('Select', () => {
  let knob;

  describe('Object values', () => {
    beforeEach(() => {
      knob = {
        name: 'Colors',
        value: '#00ff00',
        options: {
          Green: '#00ff00',
          Red: '#ff0000',
        },
      };
    });

    describe('displays value', () => {
      it('correctly maps option keys and values', () => {
        const wrapper = shallow(<SelectType knob={knob} />);

        const green = wrapper.find('option').first();
        expect(green.text()).toEqual('Green');
        expect(green.prop('value')).toEqual('Green');
      });
    });
  });

  describe('Array values', () => {
    beforeEach(() => {
      knob = {
        name: 'Colors',
        value: 'green',
        options: ['green', 'red'],
      };
    });

    describe('displays value', () => {
      it('correctly maps option keys and values', () => {
        const wrapper = shallow(<SelectType knob={knob} />);

        const green = wrapper.find('option').first();
        expect(green.text()).toEqual('green');
        expect(green.prop('value')).toEqual('green');
      });
    });
  });
});

@@ -367,49 +367,8 @@
 );%0A%0A
-    describe('displays value', () =%3E %7B%0A  
     
@@ -411,34 +411,32 @@
 alues', () =%3E %7B%0A
-  
       const wrap
@@ -471,34 +471,32 @@
 ob=%7Bknob%7D /%3E);%0A%0A
-  
       const gree
@@ -529,34 +529,32 @@
 .first();%0A      
-  
 expect(green.tex
@@ -568,34 +568,32 @@
 Equal('Green');%0A
-  
       expect(gre
@@ -624,34 +624,24 @@
 l('Green');%0A
-      %7D);%0A
     %7D);%0A  %7D)
@@ -821,49 +821,8 @@
 );%0A%0A
-    describe('displays value', () =%3E %7B%0A  
     
@@ -869,26 +869,24 @@
 s', () =%3E %7B%0A
-  
       const 
@@ -929,26 +929,24 @@
 knob%7D /%3E);%0A%0A
-  
       const 
@@ -983,34 +983,32 @@
 .first();%0A      
-  
 expect(green.tex
@@ -1026,26 +1026,24 @@
 l('green');%0A
-  
       expect
@@ -1086,18 +1086,8 @@
 ');%0A
-      %7D);%0A
     

Streamline tests