0.3.2 • Published 2 years ago

@codeshift/test-utils v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@codeshift/test-utils

applyTransform

Accepts a transform and a code string and runs the transform against it.

Works well with Jest's toMatchInlineSnapshot and toMatchSnapshot assetions.

Example:

it('should wrap avatar in a tooltip', () => {
  const result = applyTransform(
    transformer,
    `
      import Avatar from '@atlaskit/avatar';

      const App = () => {
        return <Avatar name="foo" />;
      }
    `,
    { parser: 'tsx' },
  );

  expect(result).toMatchInlineSnapshot(`
    "import Tooltip from '@atlaskit/tooltip';
      import Avatar from '@atlaskit/avatar';

      const App = () => {
        return <Tooltip content=\\"foo\\"><Avatar name=\\"foo\\" /></Tooltip>;
      }"
  `);
});
0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago