const ruleTester = require("../../ruletester");
import * as rule from "./masthead-name-changes";
ruleTester.run("masthead-name-changes", rule, {
valid: [
{
code: ``,
},
{
code: `import { MastheadBrand } from '@patternfly/react-core'; `,
},
],
invalid: [
{
code: `import { MastheadBrand } from '@patternfly/react-core'; `,
output: `import { MastheadLogo } from '@patternfly/react-core'; `,
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
type: "JSXOpeningElement",
},
],
},
// with other props
{
code: `import { MastheadBrand } from '@patternfly/react-core'; `,
output: `import { MastheadLogo } from '@patternfly/react-core'; `,
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
type: "JSXOpeningElement",
},
],
},
// with alias
{
code: `import { MastheadBrand as MB } from '@patternfly/react-core'; `,
output: `import { MastheadLogo as MB } from '@patternfly/react-core'; `,
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
type: "JSXOpeningElement",
},
],
},
// dist imports
{
code: `import { MastheadBrand } from '@patternfly/react-core/dist/esm/components/Masthead/MastheadBrand'; `,
output: `import { MastheadLogo } from '@patternfly/react-core/dist/esm/components/Masthead/MastheadLogo'; `,
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
type: "JSXOpeningElement",
},
],
},
{
code: `import { MastheadBrand } from '@patternfly/react-core/dist/js/components/Masthead/MastheadBrand'; `,
output: `import { MastheadLogo } from '@patternfly/react-core/dist/js/components/Masthead/MastheadLogo'; `,
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
type: "JSXOpeningElement",
},
],
},
{
code: `import { MastheadBrand } from '@patternfly/react-core/dist/dynamic/components/Masthead/MastheadBrand'; `,
output: `import { MastheadLogo } from '@patternfly/react-core/dist/dynamic/components/Masthead/MastheadLogo'; `,
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
type: "JSXOpeningElement",
},
],
},
],
});