"use strict";

var _react = require("@testing-library/react");
var _reactRouterDom = require("react-router-dom");
var _HomePage = _interopRequireDefault(require("./HomePage"));
var _RegistrationPage = _interopRequireDefault(require("./RegistrationPage"));
var _renderWithRouter = require("../test/renderWithRouter");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const renderHomeWithRoutes = function () {
  let initialRoute = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';
  return (0, _renderWithRouter.renderWithRouter)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Routes, {
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
      path: "/",
      element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HomePage.default, {})
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
      path: "/register",
      element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RegistrationPage.default, {})
    })]
  }), {
    route: initialRoute
  });
};
test('affiche la page d accueil', () => {
  renderHomeWithRoutes('/');
  expect(_react.screen.getByTestId('home-page')).toBeInTheDocument();
  expect(_react.screen.queryByTestId('submit')).not.toBeInTheDocument();
});
test('navigue vers le formulaire d inscription', () => {
  renderHomeWithRoutes('/');
  _react.fireEvent.click(_react.screen.getByTestId('go-to-registration'));
  expect(_react.screen.queryByTestId('home-page')).not.toBeInTheDocument();
  expect(_react.screen.getByTestId('submit')).toBeInTheDocument();
});
test('affiche les liens vers le mode legacy et la documentation', () => {
  renderHomeWithRoutes('/');
  expect(_react.screen.getByTestId('go-to-legacy')).toHaveAttribute('href', '/legacy');
  expect(_react.screen.getByTestId('go-to-docs')).toHaveAttribute('href', '/docs/index.html');
});