Files

36 lines
1022 B
TypeScript

/* eslint-disable import/no-extraneous-dependencies */
import { expect } from 'chai';
import Sinon from 'sinon';
import { TestUtils } from '../test-utils';
import { findAllByTagName, renderComponent } from './renderComponent';
import { SimpleSessionInput } from '../../components/inputs/SessionInput';
describe('SessionInput', () => {
beforeEach(() => {
TestUtils.stubSVGElement();
TestUtils.stubWindowLog();
});
afterEach(() => {
Sinon.restore();
});
it('should render an input', async () => {
const result = renderComponent(
<SimpleSessionInput
type="text"
errorDataTestId={null as any}
onEnterPressed={null as any}
onValueChanged={null as any}
providedError={null as any}
/>
);
// Using findAllByTagName to find input elements by tag name
const inputElements = findAllByTagName<HTMLInputElement>(result, 'input');
expect(inputElements.length, 'should have an input element').to.equal(1);
result.unmount();
});
});