Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 2x 2x 1x 1x 1x 1x 1x | /* * Copyright (c) 2021, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { pascalCase, camelCase, paramCase } from 'change-case'; export const buildTest = (contents) => { const { componentName } = contents; const pascal = pascalCase(componentName); const param = paramCase(componentName); const camel = camelCase(componentName); return `import { createElement } from "lwc"; import ${pascal} from "c/${camel}"; // import { registerLdsTestWireAdapter } from '@salesforce/sfdx-lwc-jest'; // import { registerApexTestWireAdapter } from '@salesforce/sfdx-lwc-jest'; describe("c-${param}", () => { afterEach(() => { while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } jest.clearAllMocks(); }); it("has component name on the header", () => { const element = createElement("c-${param}", { is: ${pascal} }); document.body.appendChild(element); return Promise.resolve().then(() => { const componentHeader = element.shadowRoot.querySelector("h1"); expect(componentHeader.textContent).toBe("${componentName}"); }); }); });`; }; |