Files
vercel__workflow/packages/web-shared/test/error-stack-block.test.ts
Mitul Shah 14b52ac04b [1/4] Replace shared observability component styles with Tailwind (#3295)
* Replace hard-coded UI styles with Tailwind

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* Update Tailwind migration verification

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* Remove documentation changes from style migration

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* Split trace, graph, and workbench style changes

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

---------

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mitul-s <19615826+mitul-s@users.noreply.github.com>
2026-08-12 19:13:39 +00:00

52 lines
1.5 KiB
TypeScript

import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { describe, expect, it } from 'vitest';
import {
ErrorStackBlock,
isStructuredError,
isStructuredErrorWithStack,
} from '../src/components/ui/error-stack-block.js';
describe('ErrorStackBlock', () => {
it('recognizes persisted message-only errors as structured errors', () => {
const error = {
message: 'Workflow replay exceeded maximum duration after 4 attempts',
};
expect(isStructuredError(error)).toBe(true);
expect(isStructuredErrorWithStack(error)).toBe(false);
});
it('renders message-only errors with the error block', () => {
const markup = renderToStaticMarkup(
createElement(ErrorStackBlock, {
value: {
message: 'Workflow replay exceeded maximum duration after 4 attempts',
},
})
);
expect(markup).toContain('Copy error');
expect(markup).toContain(
'Workflow replay exceeded maximum duration after 4 attempts'
);
expect(markup).toContain('bg-red-100');
});
it('ignores non-string stack values on message-only errors', () => {
const markup = renderToStaticMarkup(
createElement(ErrorStackBlock, {
value: {
message: 'Workflow replay exceeded maximum duration after 4 attempts',
stack: 123,
},
})
);
expect(markup).toContain(
'Workflow replay exceeded maximum duration after 4 attempts'
);
expect(markup).not.toContain('123');
});
});