import {render, screen, within} from 'sentry-test/reactTestingLibrary'; import Line from 'sentry/components/events/interfaces/frame/line'; import {Frame} from 'sentry/types'; describe('Frame - Line', function () { const event = TestStubs.Event(); const data: Frame = { absPath: null, colNo: null, context: [], errors: null, filename: null, function: null, inApp: false, instructionAddr: null, lineNo: null, module: null, package: null, platform: null, rawFunction: null, symbol: null, symbolAddr: null, trust: null, vars: null, }; describe('renderOriginalSourceInfo()', function () { it('should render the source map information as a HTML string', function () { const {container} = render( ); expect(container).toSnapshot(); }); }); describe('renderContext()', () => { it('should render context lines', () => { render( ); expect(screen.getByRole('list')).toSnapshot(); }); it('should render register values', () => { render( ); expect(screen.getByText('Registers')).toBeInTheDocument(); }); it('should not render empty registers', () => { render( ); expect(screen.queryByText('Registers')).not.toBeInTheDocument(); }); it('should render context vars', () => { const vars = { origin: null, helper: '', self: '', args: [], request: '', content: '[Filtered]', kwargs: {}, project_id: "u'3'", }; render( ); for (const [key, value] of Object.entries(vars)) { const row = screen.getByText(key).closest('tr'); expect(row).toBeTruthy(); if (!row) { return; } const utils = within(row); expect(utils.getByText(key)).toBeInTheDocument(); if (typeof value !== 'string') { return; } expect(utils.getByText(value)).toBeInTheDocument(); } }); }); });