2025-11-22 08:17:29 +05:30
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { render } from '../../test-utils/render.js';
|
|
|
|
|
import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js';
|
|
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
|
|
|
|
|
describe('ConsoleSummaryDisplay', () => {
|
2026-02-18 16:46:50 -08:00
|
|
|
it('renders nothing when errorCount is 0', async () => {
|
2026-03-20 20:08:29 +00:00
|
|
|
const { lastFrame, unmount } = await render(
|
2026-02-18 16:46:50 -08:00
|
|
|
<ConsoleSummaryDisplay errorCount={0} />,
|
|
|
|
|
);
|
|
|
|
|
expect(lastFrame({ allowEmpty: true })).toBe('');
|
|
|
|
|
unmount();
|
2025-11-22 08:17:29 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.each([
|
|
|
|
|
[1, '1 error'],
|
|
|
|
|
[5, '5 errors'],
|
2026-02-18 16:46:50 -08:00
|
|
|
])('renders correct message for %i errors', async (count, expectedText) => {
|
2026-03-20 20:08:29 +00:00
|
|
|
const { lastFrame, unmount } = await render(
|
2026-02-18 16:46:50 -08:00
|
|
|
<ConsoleSummaryDisplay errorCount={count} />,
|
|
|
|
|
);
|
2025-11-22 08:17:29 +05:30
|
|
|
const output = lastFrame();
|
|
|
|
|
expect(output).toContain(expectedText);
|
|
|
|
|
expect(output).toContain('✖');
|
|
|
|
|
expect(output).toContain('(F12 for details)');
|
2026-02-18 16:46:50 -08:00
|
|
|
unmount();
|
2025-11-22 08:17:29 +05:30
|
|
|
});
|
|
|
|
|
});
|