import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { AuthProvider } from '../context/AuthProvider';
import LoginPage from './LoginPage';
const pass = 'pass';
const user = 'user';
class ResizeObserver {
observe() {}
unobserve() {}
}
describe('loginpage ', () => {
window.ResizeObserver = ResizeObserver;
test('should update username and password', async () => {
const { findByPlaceholderText } = render(
<AuthProvider>
<LoginPage />
</AuthProvider>,
);
const username = await findByPlaceholderText('Your username...');
const password = await findByPlaceholderText('Password...');
fireEvent.change(username, { target: { value: user } });
fireEvent.change(password, { target: { value: pass } });
expect(username.value).toBe(user);
expect(password.value).toBe(pass);
});
});