0.3.2 • Published 12 months ago

@codeshift/test-utils v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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

12 months ago

0.3.1

12 months ago

0.3.0

1 year ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago