|
3 | 3 | MAX_WIDTH, |
4 | 4 | parseEnvinfoSections, |
5 | 5 | renderAliasHelp, |
6 | | - renderCommandFooter, |
7 | | - renderCommandHeader, |
8 | 6 | renderCommandHelp, |
9 | 7 | renderError, |
10 | 8 | renderFooter, |
11 | | - renderInfo, |
12 | 9 | renderInfoOutput, |
13 | 10 | renderOptionHelp, |
14 | 11 | renderSuccess, |
@@ -292,84 +289,6 @@ describe("renderCommandHelp", () => { |
292 | 289 | }); |
293 | 290 | }); |
294 | 291 |
|
295 | | -describe("renderCommandHeader", () => { |
296 | | - it("should render 'webpack <name>' in the header", () => { |
297 | | - const { captured, opts } = makeOpts(); |
298 | | - renderCommandHeader({ name: "build", description: "Compiling." }, opts); |
299 | | - expect(getOutput(captured)).toContain("webpack build"); |
300 | | - }); |
301 | | - |
302 | | - it("should render the description", () => { |
303 | | - const { captured, opts } = makeOpts(); |
304 | | - renderCommandHeader({ name: "build", description: "Compiling." }, opts); |
305 | | - expect(getOutput(captured)).toContain("Compiling."); |
306 | | - }); |
307 | | - |
308 | | - it("should render a divider", () => { |
309 | | - const { captured, opts } = makeOpts(); |
310 | | - renderCommandHeader({ name: "build", description: "Compiling." }, opts); |
311 | | - expect(captured.some((l) => /─{10,}/.test(l))).toBe(true); |
312 | | - }); |
313 | | - |
314 | | - it("should include the ⬡ icon", () => { |
315 | | - const { captured, opts } = makeOpts(); |
316 | | - renderCommandHeader({ name: "build", description: "Compiling." }, opts); |
317 | | - expect(getOutput(captured)).toContain("⬡"); |
318 | | - }); |
319 | | - |
320 | | - it("should omit description block when empty", () => { |
321 | | - const { captured, opts } = makeOpts(); |
322 | | - renderCommandHeader({ name: "build", description: "" }, opts); |
323 | | - const nonEmpty = captured.filter((l) => l.trim().length > 0); |
324 | | - expect(nonEmpty).toHaveLength(2); // icon+title + divider |
325 | | - }); |
326 | | - |
327 | | - it("should cap divider at MAX_WIDTH on wide terminals", () => { |
328 | | - const { captured, opts } = makeOpts(300); |
329 | | - renderCommandHeader({ name: "build", description: "Building." }, opts); |
330 | | - const div = captured.find((l) => /─{10,}/.test(l)); |
331 | | - expect(stripAnsi(div).length).toBeLessThanOrEqual(INDENT + MAX_WIDTH); |
332 | | - }); |
333 | | - |
334 | | - it("should match snapshot", () => { |
335 | | - const { captured, opts } = makeOpts(); |
336 | | - renderCommandHeader({ name: "build", description: "Compiling." }, opts); |
337 | | - expect(captured).toMatchSnapshot(); |
338 | | - }); |
339 | | -}); |
340 | | - |
341 | | -describe("renderCommandFooter", () => { |
342 | | - it("should render a divider", () => { |
343 | | - const { captured, opts } = makeOpts(); |
344 | | - renderCommandFooter(opts); |
345 | | - expect(captured.some((l) => /─{10,}/.test(l))).toBe(true); |
346 | | - }); |
347 | | - |
348 | | - it("should end with a blank line", () => { |
349 | | - const { captured, opts } = makeOpts(); |
350 | | - renderCommandFooter(opts); |
351 | | - expect(captured[captured.length - 1]).toBe(""); |
352 | | - }); |
353 | | - |
354 | | - it("header and footer dividers should be the same length", () => { |
355 | | - const hCapture = makeOpts(80); |
356 | | - renderCommandHeader({ name: "build", description: "" }, hCapture.opts); |
357 | | - const hDiv = hCapture.captured.find((l) => /─{10,}/.test(l)); |
358 | | - |
359 | | - const fCapture = makeOpts(80); |
360 | | - renderCommandFooter(fCapture.opts); |
361 | | - const fDiv = fCapture.captured.find((l) => /─{10,}/.test(l)); |
362 | | - |
363 | | - expect(stripAnsi(hDiv)).toHaveLength(stripAnsi(fDiv).length); |
364 | | - }); |
365 | | - |
366 | | - it("should match snapshot", () => { |
367 | | - const { captured, opts } = makeOpts(); |
368 | | - renderCommandFooter(opts); |
369 | | - expect(captured).toMatchSnapshot(); |
370 | | - }); |
371 | | -}); |
372 | | - |
373 | 292 | describe("renderOptionHelp", () => { |
374 | 293 | it("should render option name in header", () => { |
375 | 294 | const { captured, opts } = makeOpts(); |
@@ -573,21 +492,6 @@ describe("renderWarning", () => { |
573 | 492 | }); |
574 | 493 | }); |
575 | 494 |
|
576 | | -describe("renderInfo", () => { |
577 | | - it("outputs message with ℹ", () => { |
578 | | - const { captured, opts } = makeOpts(); |
579 | | - renderInfo("just so you know", opts); |
580 | | - expect(getOutput(captured)).toContain("ℹ"); |
581 | | - expect(getOutput(captured)).toContain("just so you know"); |
582 | | - }); |
583 | | - |
584 | | - it("should match snapshot", () => { |
585 | | - const { captured, opts } = makeOpts(); |
586 | | - renderInfo("just so you know", opts); |
587 | | - expect(captured).toMatchSnapshot(); |
588 | | - }); |
589 | | -}); |
590 | | - |
591 | 495 | describe("parseEnvinfoSections", () => { |
592 | 496 | it("returns one section per heading", () => { |
593 | 497 | const sections = parseEnvinfoSections(ENVINFO_FIXTURE); |
|
0 commit comments