diff --git a/plugins/cc-cli/templates/accessibility/import/import.ts.js b/plugins/cc-cli/templates/accessibility/import/import.ts.js index 3a2b25b59..4c698f167 100644 --- a/plugins/cc-cli/templates/accessibility/import/import.ts.js +++ b/plugins/cc-cli/templates/accessibility/import/import.ts.js @@ -1,3 +1,3 @@ -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +import { run, AxeResults }from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; \ No newline at end of file diff --git a/plugins/cc-cli/test/__snapshots__/document-enzyme-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/document-enzyme-bundle-ts.test.ts.snap index 2cc0e0d41..6243a8297 100644 --- a/plugins/cc-cli/test/__snapshots__/document-enzyme-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/document-enzyme-bundle-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enzyme bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import { mount, configure } from 'enzyme'; @@ -13,12 +12,12 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; configure({ adapter: new Adapter() }); - - describe('Components/Header', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; - Object.keys(store.docs).forEach(docId => { + Object.keys(store.docs).forEach(docId => { const doc = store.docs[docId]; if (doc.stories && doc.stories.length) { const stories = doc.stories; @@ -32,11 +31,10 @@ describe('Components/Header', () => { expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); }); it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - }); + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); + }); }); }); } diff --git a/plugins/cc-cli/test/__snapshots__/document-enzyme-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/document-enzyme-ts.test.ts.snap index 7cd15b1c3..3a437e6f5 100644 --- a/plugins/cc-cli/test/__snapshots__/document-enzyme-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/document-enzyme-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enzyme ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadConfigurations } from '@component-controls/config'; import { renderDocument } from '@component-controls/test-renderers'; @@ -17,16 +16,15 @@ configure({ adapter: new Adapter() }); import * as examples from './fixtures/VariantButton.docs'; describe('VariantButton', () => { - const configPath = path.resolve(__dirname, '.config'); + const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); const renderedExamples = renderDocument(examples, config); -renderedExamples.forEach(({ name, rendered}) => { - it(name, async () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + renderedExamples.forEach(({ name, rendered }) => { + it(name, async () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); }); }); - -}); " `; diff --git a/plugins/cc-cli/test/__snapshots__/document-rtl-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/document-rtl-bundle-ts.test.ts.snap index 60d2e1773..0e88c5f61 100644 --- a/plugins/cc-cli/test/__snapshots__/document-rtl-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/document-rtl-bundle-ts.test.ts.snap @@ -1,21 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtl bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import { render, act } from '@testing-library/react'; import { renderErr } from '@component-controls/test-renderers'; - - describe('Components/Header', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; - Object.keys(store.docs).forEach(docId => { + Object.keys(store.docs).forEach(docId => { const doc = store.docs[docId]; if (doc.stories && doc.stories.length) { const stories = doc.stories; @@ -26,7 +25,7 @@ describe('Components/Header', () => { let rendered; act(() => { rendered = renderFn(story, doc); - }); + }); if (!rendered) { renderErr(); return; @@ -34,12 +33,11 @@ describe('Components/Header', () => { it('snapshot', () => { const { asFragment } = render(rendered); expect(asFragment()).toMatchSnapshot(); - }); + }); it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); }); }); diff --git a/plugins/cc-cli/test/__snapshots__/document-rtl-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/document-rtl-ts.test.ts.snap index 36a2005b1..ff9171d76 100644 --- a/plugins/cc-cli/test/__snapshots__/document-rtl-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/document-rtl-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtl ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadConfigurations } from '@component-controls/config'; import { renderDocument } from '@component-controls/test-renderers'; @@ -14,24 +13,22 @@ import { renderErr } from '@component-controls/test-renderers'; import * as examples from './fixtures/VariantButton.docs'; describe('VariantButton', () => { - const configPath = path.resolve(__dirname, '.config'); + const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); - let renderedExamples : ReturnType = []; -act(() => { - renderedExamples = renderDocument(examples, config); -}); -if (!renderedExamples) { - renderErr(); - return; -} -renderedExamples.forEach(({ name, rendered}) => { - it(name, async () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); - + let renderedExamples: ReturnType = []; + act(() => { + renderedExamples = renderDocument(examples, config); + }); + if (!renderedExamples) { + renderErr(); + return; + } + renderedExamples.forEach(({ name, rendered }) => { + it(name, async () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); }); -}); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/document-rtr-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/document-rtr-bundle-ts.test.ts.snap index 0fbe4e46f..be9e31c5e 100644 --- a/plugins/cc-cli/test/__snapshots__/document-rtr-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/document-rtr-bundle-ts.test.ts.snap @@ -1,21 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtr bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import renderer, { act } from 'react-test-renderer'; import { renderErr, componentErr } from '@component-controls/test-renderers'; - - describe('Components/Header', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; - Object.keys(store.docs).forEach(docId => { + Object.keys(store.docs).forEach(docId => { const doc = store.docs[docId]; if (doc.stories && doc.stories.length) { const stories = doc.stories; @@ -26,7 +25,7 @@ describe('Components/Header', () => { let rendered; act(() => { rendered = renderFn(story, doc); - }); + }); if (!rendered) { renderErr(); return; @@ -36,14 +35,13 @@ describe('Components/Header', () => { if (!component) { componentErr(); return; - } + } expect(component.toJSON()).toMatchSnapshot(); }); it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); }); }); diff --git a/plugins/cc-cli/test/__snapshots__/document-rtr-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/document-rtr-ts.test.ts.snap index 7dce2c8c3..eacce48ab 100644 --- a/plugins/cc-cli/test/__snapshots__/document-rtr-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/document-rtr-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtr ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadConfigurations } from '@component-controls/config'; import { renderDocument } from '@component-controls/test-renderers'; @@ -14,27 +13,26 @@ import { renderErr, componentErr } from '@component-controls/test-renderers'; import * as examples from './fixtures/VariantButton.docs'; describe('VariantButton', () => { - const configPath = path.resolve(__dirname, '.config'); + const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); - let renderedExamples : ReturnType = []; -act(() => { - renderedExamples = renderDocument(examples, config); -}); -if (!renderedExamples.length) { - renderErr(); - return; -} -renderedExamples.forEach(({ name, rendered}) => { - it(name, async () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); + let renderedExamples: ReturnType = []; + act(() => { + renderedExamples = renderDocument(examples, config); + }); + if (!renderedExamples.length) { + renderErr(); + return; + } + renderedExamples.forEach(({ name, rendered }) => { + it(name, async () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); }); -}); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/store-enzyme-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/store-enzyme-bundle-ts.test.ts.snap index a6ed3b620..e5f32deec 100644 --- a/plugins/cc-cli/test/__snapshots__/store-enzyme-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/store-enzyme-bundle-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enzyme bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import { mount, configure } from 'enzyme'; @@ -13,9 +12,10 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; configure({ adapter: new Adapter() }); - describe('component-controls generated', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; Object.keys(store.docs).forEach(docId => { const doc = store.docs[docId]; @@ -25,24 +25,21 @@ describe('component-controls generated', () => { stories.forEach(storyId => { const story = store.stories[storyId]; describe(story.name, () => { - -const rendered = renderFn(story, doc); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); + const rendered = renderFn(story, doc); + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); }); }); } }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/store-enzyme-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/store-enzyme-ts.test.ts.snap index ccfdc716d..72b370ab6 100644 --- a/plugins/cc-cli/test/__snapshots__/store-enzyme-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/store-enzyme-ts.test.ts.snap @@ -1,12 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enzyme ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; -import { loadConfigurations, extractDocuments, isMDXDocument } from '@component-controls/config'; +import { + loadConfigurations, + extractDocuments, + isMDXDocument, +} from '@component-controls/config'; import { renderExample } from '@component-controls/test-renderers'; import { mount, configure } from 'enzyme'; import toJson from 'enzyme-to-json'; @@ -14,47 +17,48 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; configure({ adapter: new Adapter() }); - describe('component-controls generated', () => { const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); const documents = extractDocuments({ config, configPath }); if (documents) { - documents.filter((file: string) => !isMDXDocument(file, config.instrument)).forEach((file: string) => { - // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-dynamic-require - const exports = require(file); - const doc = exports.default; - const examples = Object.keys(exports) - .filter(key => key !== 'default') - .map(key => exports[key]); - - if (examples.length) { - describe(doc.title, () => { - examples.forEach(example => { - describe(example.name, () => { - -const rendered = renderExample({ - example, - doc, - config, -}); + documents + .filter((file: string) => !isMDXDocument(file, config.instrument)) + .forEach((file: string) => { + // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-dynamic-require + const exports = require(file); + const doc = exports.default; + const examples = Object.keys(exports) + .filter(key => key !== 'default') + .map(key => exports[key]); -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); + if (examples.length) { + describe(doc.title, () => { + examples.forEach(example => { + describe(example.name, () => { + const rendered = renderExample({ + example, + doc, + config, + }); + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM( + rendered, + run, + ); + expect(axeResults).toHaveNoAxeViolations(); + }); + }); }); }); - }); - } - }); + } + }); } - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/store-rtl-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/store-rtl-bundle-ts.test.ts.snap index 25829f62a..81564af72 100644 --- a/plugins/cc-cli/test/__snapshots__/store-rtl-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/store-rtl-bundle-ts.test.ts.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtl bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import { render, act } from '@testing-library/react'; import { renderErr } from '@component-controls/test-renderers'; - describe('component-controls generated', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; Object.keys(store.docs).forEach(docId => { const doc = store.docs[docId]; @@ -22,31 +22,27 @@ describe('component-controls generated', () => { stories.forEach(storyId => { const story = store.stories[storyId]; describe(story.name, () => { - let rendered; -act(() => { - - rendered = renderFn(story, doc); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + let rendered; + act(() => { + rendered = renderFn(story, doc); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); }); }); } }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/store-rtl-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/store-rtl-ts.test.ts.snap index 97e7de102..ce24977e5 100644 --- a/plugins/cc-cli/test/__snapshots__/store-rtl-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/store-rtl-ts.test.ts.snap @@ -1,64 +1,67 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtl ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; -import { loadConfigurations, extractDocuments, isMDXDocument } from '@component-controls/config'; +import { + loadConfigurations, + extractDocuments, + isMDXDocument, +} from '@component-controls/config'; import { renderExample } from '@component-controls/test-renderers'; import { render, act } from '@testing-library/react'; import { renderErr } from '@component-controls/test-renderers'; - describe('component-controls generated', () => { const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); const documents = extractDocuments({ config, configPath }); if (documents) { - documents.filter((file: string) => !isMDXDocument(file, config.instrument)).forEach((file: string) => { - // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-dynamic-require - const exports = require(file); - const doc = exports.default; - const examples = Object.keys(exports) - .filter(key => key !== 'default') - .map(key => exports[key]); - - if (examples.length) { - describe(doc.title, () => { - examples.forEach(example => { - describe(example.name, () => { -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); + documents + .filter((file: string) => !isMDXDocument(file, config.instrument)) + .forEach((file: string) => { + // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-dynamic-require + const exports = require(file); + const doc = exports.default; + const examples = Object.keys(exports) + .filter(key => key !== 'default') + .map(key => exports[key]); + if (examples.length) { + describe(doc.title, () => { + examples.forEach(example => { + describe(example.name, () => { + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM( + rendered, + run, + ); + expect(axeResults).toHaveNoAxeViolations(); + }); + }); }); }); - }); - } - }); + } + }); } - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/store-rtr-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/store-rtr-bundle-ts.test.ts.snap index 2826c11e5..f5415ee03 100644 --- a/plugins/cc-cli/test/__snapshots__/store-rtr-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/store-rtr-bundle-ts.test.ts.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtr bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import renderer, { act } from 'react-test-renderer'; import { renderErr, componentErr } from '@component-controls/test-renderers'; - describe('component-controls generated', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; Object.keys(store.docs).forEach(docId => { const doc = store.docs[docId]; @@ -22,36 +22,31 @@ describe('component-controls generated', () => { stories.forEach(storyId => { const story = store.stories[storyId]; describe(story.name, () => { - let rendered; -act(() => { - - rendered = renderFn(story, doc); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + let rendered; + act(() => { + rendered = renderFn(story, doc); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); }); }); } }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/store-rtr-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/store-rtr-ts.test.ts.snap index 61660a227..21faedcb6 100644 --- a/plugins/cc-cli/test/__snapshots__/store-rtr-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/store-rtr-ts.test.ts.snap @@ -1,69 +1,71 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtr ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; -import { loadConfigurations, extractDocuments, isMDXDocument } from '@component-controls/config'; +import { + loadConfigurations, + extractDocuments, + isMDXDocument, +} from '@component-controls/config'; import { renderExample } from '@component-controls/test-renderers'; import renderer, { act } from 'react-test-renderer'; import { renderErr, componentErr } from '@component-controls/test-renderers'; - describe('component-controls generated', () => { const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); const documents = extractDocuments({ config, configPath }); if (documents) { - documents.filter((file: string) => !isMDXDocument(file, config.instrument)).forEach((file: string) => { - // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-dynamic-require - const exports = require(file); - const doc = exports.default; - const examples = Object.keys(exports) - .filter(key => key !== 'default') - .map(key => exports[key]); - - if (examples.length) { - describe(doc.title, () => { - examples.forEach(example => { - describe(example.name, () => { -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + documents + .filter((file: string) => !isMDXDocument(file, config.instrument)) + .forEach((file: string) => { + // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-dynamic-require + const exports = require(file); + const doc = exports.default; + const examples = Object.keys(exports) + .filter(key => key !== 'default') + .map(key => exports[key]); + if (examples.length) { + describe(doc.title, () => { + examples.forEach(example => { + describe(example.name, () => { + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM( + rendered, + run, + ); + expect(axeResults).toHaveNoAxeViolations(); + }); + }); }); }); - }); - } - }); + } + }); } - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/story-enzyme-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/story-enzyme-bundle-ts.test.ts.snap index 2c8031c68..e8ea58b2b 100644 --- a/plugins/cc-cli/test/__snapshots__/story-enzyme-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/story-enzyme-bundle-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enzyme bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import { mount, configure } from 'enzyme'; @@ -13,31 +12,27 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; configure({ adapter: new Adapter() }); - - describe('Components/Header', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; -const doc = store.docs['Components/Header']; + const doc = store.docs['Components/Header']; describe('Overview', () => { - - const story = store.stories['components-header--overview']; - - -const rendered = renderFn(story, doc); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const story = store.stories['components-header--overview']; + + const rendered = renderFn(story, doc); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/story-enzyme-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/story-enzyme-ts.test.ts.snap index 66ad0e516..e07ea838a 100644 --- a/plugins/cc-cli/test/__snapshots__/story-enzyme-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/story-enzyme-ts.test.ts.snap @@ -1,10 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enzyme ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadConfigurations } from '@component-controls/config'; import { renderExample } from '@component-controls/test-renderers'; @@ -14,167 +13,152 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; configure({ adapter: new Adapter() }); -import doc, { overview, primary, accent, disabled, success, error, warning } from './fixtures/VariantButton.docs'; +import doc, { + overview, + primary, + accent, + disabled, + success, + error, + warning, +} from './fixtures/VariantButton.docs'; describe('VariantButton', () => { const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); - describe('overview', () => { - - const example = overview; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = overview; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('primary', () => { - - const example = primary; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = primary; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('accent', () => { - - const example = accent; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = accent; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('disabled', () => { - - const example = disabled; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = disabled; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('success', () => { - - const example = success; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = success; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('error', () => { - - const example = error; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = error; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('warning', () => { - - const example = warning; - - -const rendered = renderExample({ - example, - doc, - config, -}); - -it('snapshot', () => { - const component = mount(rendered); - expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = warning; + + const rendered = renderExample({ + example, + doc, + config, + }); + + it('snapshot', () => { + const component = mount(rendered); + expect(toJson(component, { mode: 'deep' })).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/story-rtl-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/story-rtl-bundle-ts.test.ts.snap index 015a48217..fb109ca50 100644 --- a/plugins/cc-cli/test/__snapshots__/story-rtl-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/story-rtl-bundle-ts.test.ts.snap @@ -1,47 +1,41 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtl bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import { render, act } from '@testing-library/react'; import { renderErr } from '@component-controls/test-renderers'; - - describe('Components/Header', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; -const doc = store.docs['Components/Header']; + const doc = store.docs['Components/Header']; describe('Overview', () => { - - const story = store.stories['components-header--overview']; - -let rendered; -act(() => { - - rendered = renderFn(story, doc); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); + const story = store.stories['components-header--overview']; + let rendered; + act(() => { + rendered = renderFn(story, doc); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/story-rtl-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/story-rtl-ts.test.ts.snap index cbf3069bf..31dd586f6 100644 --- a/plugins/cc-cli/test/__snapshots__/story-rtl-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/story-rtl-ts.test.ts.snap @@ -1,226 +1,203 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtl ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadConfigurations } from '@component-controls/config'; import { renderExample } from '@component-controls/test-renderers'; import { render, act } from '@testing-library/react'; import { renderErr } from '@component-controls/test-renderers'; -import doc, { overview, primary, accent, disabled, success, error, warning } from './fixtures/VariantButton.docs'; +import doc, { + overview, + primary, + accent, + disabled, + success, + error, + warning, +} from './fixtures/VariantButton.docs'; describe('VariantButton', () => { const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); - describe('overview', () => { - - const example = overview; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = overview; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('primary', () => { - - const example = primary; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = primary; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('accent', () => { - - const example = accent; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = accent; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('disabled', () => { - - const example = disabled; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = disabled; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('success', () => { - - const example = success; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = success; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('error', () => { - - const example = error; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - + const example = error; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('warning', () => { - - const example = warning; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, + const example = warning; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const { asFragment } = render(rendered); + expect(asFragment()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); - -}); -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const { asFragment } = render(rendered); - expect(asFragment()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/story-rtr-bundle-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/story-rtr-bundle-ts.test.ts.snap index 9086bc998..4464bb04b 100644 --- a/plugins/cc-cli/test/__snapshots__/story-rtr-bundle-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/story-rtr-bundle-ts.test.ts.snap @@ -1,52 +1,45 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtr bundle ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadStore } from '@component-controls/store'; import renderer, { act } from 'react-test-renderer'; import { renderErr, componentErr } from '@component-controls/test-renderers'; - - describe('Components/Header', () => { - const store = loadStore(require(path.resolve(__dirname, './bundle/component-controls.js'))); + const store = loadStore( + require(path.resolve(__dirname, './bundle/component-controls.js')), + ); const renderFn = store.config.renderFn; -const doc = store.docs['Components/Header']; + const doc = store.docs['Components/Header']; describe('Overview', () => { - - const story = store.stories['components-header--overview']; - -let rendered; -act(() => { - - rendered = renderFn(story, doc); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const story = store.stories['components-header--overview']; + + let rendered; + act(() => { + rendered = renderFn(story, doc); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); - }); " `; diff --git a/plugins/cc-cli/test/__snapshots__/story-rtr-ts.test.ts.snap b/plugins/cc-cli/test/__snapshots__/story-rtr-ts.test.ts.snap index 12529766b..c3fb47805 100644 --- a/plugins/cc-cli/test/__snapshots__/story-rtr-ts.test.ts.snap +++ b/plugins/cc-cli/test/__snapshots__/story-rtr-ts.test.ts.snap @@ -1,261 +1,231 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rtr ts 1`] = ` -" -import * as path from 'path'; -import { run, AxeResults } = require('axe-core'); -import { reactRunDOM } = require('@component-controls/test-renderers'); +"import * as path from 'path'; +import { run, AxeResults } from 'axe-core'; +import { reactRunDOM } from '@component-controls/test-renderers'; import '@component-controls/jest-axe-matcher'; import { loadConfigurations } from '@component-controls/config'; import { renderExample } from '@component-controls/test-renderers'; import renderer, { act } from 'react-test-renderer'; import { renderErr, componentErr } from '@component-controls/test-renderers'; -import doc, { overview, primary, accent, disabled, success, error, warning } from './fixtures/VariantButton.docs'; +import doc, { + overview, + primary, + accent, + disabled, + success, + error, + warning, +} from './fixtures/VariantButton.docs'; describe('VariantButton', () => { const configPath = path.resolve(__dirname, '.config'); const config = loadConfigurations(configPath); - describe('overview', () => { - - const example = overview; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const example = overview; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('primary', () => { - - const example = primary; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const example = primary; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('accent', () => { - - const example = accent; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const example = accent; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('disabled', () => { - - const example = disabled; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const example = disabled; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('success', () => { - - const example = success; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const example = success; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('error', () => { - - const example = error; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, - }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - + const example = error; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); describe('warning', () => { - - const example = warning; - -let rendered; -act(() => { - - rendered = renderExample({ - example, - doc, - config, + const example = warning; + + let rendered; + act(() => { + rendered = renderExample({ + example, + doc, + config, + }); + }); + if (!rendered) { + renderErr(); + return; + } + it('snapshot', () => { + const component = renderer.create(rendered); + if (!component) { + componentErr(); + return; + } + expect(component.toJSON()).toMatchSnapshot(); + }); + it('accessibility', async () => { + const axeResults = await reactRunDOM(rendered, run); + expect(axeResults).toHaveNoAxeViolations(); + }); }); - -}) -if (!rendered) { - renderErr(); - return; -} -it('snapshot', () => { - const component = renderer.create(rendered); - if (!component) { - componentErr(); - return; - } - expect(component.toJSON()).toMatchSnapshot(); -}); -it('accessibility', async () => { - const axeResults = await reactRunDOM(rendered, run); - expect(axeResults).toHaveNoAxeViolations(); -}); - - - }); - }); " `;