import { describe, expect, jest, test, } from '@jest/globals'; import { render, fireEvent } from '@testing-library/react'; import * as React from 'react'; import Attribute from '../src/Attribute'; import { BubbleType } from '../src/types'; describe('Attribute component', () => { test('renders properly', () => { const actions = 'actions'; const { container } = render( , ); expect(container).toMatchSnapshot(); }); test('click value should open bubble', () => { const showBubble = jest.fn(); const { getByText } = render( , ); fireEvent.click(getByText('value')); expect(showBubble).toHaveBeenCalledWith({ attribute: 'name', element: 'element', id: ['id'], left: 0, show: true, top: 0, type: BubbleType.ASKER, value: 'value', }); }); test('click name should open bubble', () => { const showBubble = jest.fn(); const { getByText } = render( , ); fireEvent.click(getByText('name')); expect(showBubble).toHaveBeenCalledWith({ attribute: 'name', element: 'element', id: ['id'], left: 0, show: true, top: 0, type: BubbleType.MENU, value: 'value', }); }); });