jest.autoMockOff();
import { renameSmartLinksProp } from '../migrates/rename-smartlinks-prop';
import { createTransformer } from '../utils';
// This stays as require() since changing to import will trigger a linter error
// Ignored via go/ees005
// eslint-disable-next-line import/no-commonjs
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
const transformer = createTransformer('@atlaskit/editor-core', [renameSmartLinksProp]);
describe('Rename smartLinks to inside linking prop', () => {
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename nothing if smartLinks prop not set',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename nothing if boolean prop',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename nothing if smartLinks not found',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename nothing if linking prop already exists',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename nothing if linking prop already exists with smartLinks key',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename smartLinks to key inside linking and do not change other options',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
import { Editor as AKEditor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
`
import React from 'react';
import { Editor as AKEditor } from '@atlaskit/editor-core';
export default () => (
);
`, // -----
'rename smartLinks to key inside linking when Editor is renamed',
);
defineInlineTest(
{ default: transformer, parser: 'tsx' },
{},
`
import React from 'react';
const Editor = (props) => {
{props.children}
};
export default () => (
);
`, // -----
`
import React from 'react';
const Editor = (props) => {
{props.children}
};
export default () => (
);
`, // -----
'rename nothing if smartLinks for Editor is not from @atlaskit/editor-core',
);
});