import updateClassName from '../update-class-name' ; describe ( 'Update ClassName' , ( ) => { it ( 'should update small component' , ( ) => { const result = updateClassName ( { lineNumber : 4 , columnNumber : 9 , className : 'lowercase p-4' , code : `import React from 'react';

const Example = () => {
  return <div className="uppercase p-4">Example Component</div>;
};

export default Example;
` , } ) ; expect ( result ) . toEqual ( `import React from 'react';

const Example = () => {
  return <div className="lowercase p-4">Example Component</div>;
};

export default Example;
` ) ; } ) ; it ( 'should update first className' , ( ) => { const result = updateClassName ( { lineNumber : 5 , columnNumber : 4 , className : 'p-6' , code : `import React from 'react';

const Example = () => {
  return (
    <div className="p-4">
      <span className="p-2"></span>
    </div>
  );
};

export default Example;
` , } ) ; expect ( result ) . toEqual ( `import React from 'react';

const Example = () => {
  return (
    <div className="p-6">
      <span className="p-2"></span>
    </div>
  );
};

export default Example;
` ) ; } ) ; it ( 'should add className to div with no className' , ( ) => { const result = updateClassName ( { lineNumber : 4 , columnNumber : 9 , className : 'p-4' , code : `import React from 'react';

const Example = () => {
  return <div></div>;
};

export default Example;
` , } ) ; expect ( result ) . toEqual ( `import React from 'react';

const Example = () => {
  return <div className="p-4"></div>;
};

export default Example;
` ) ; } ) ; it ( 'should update className on img self closing tag' , ( ) => { const result = updateClassName ( { lineNumber : 4 , columnNumber : 9 , className : 'm-4' , code : `import React from 'react';

const Example = () => {
  return <img className="m-2" />;
};

export default Example;
` , } ) ; expect ( result ) . toEqual ( `import React from 'react';

const Example = () => {
  return <img className="m-4" />;
};

export default Example;
` ) ; } ) ; } ) ;