From 965c9c3b2e7ebfed0c936d1c3580305f9e00f75c Mon Sep 17 00:00:00 2001 From: Raymond Debasa Peralta Date: Mon, 11 Mar 2024 13:33:13 +0100 Subject: [PATCH] Version mejorada test --- webapp/src/components/AddUser.test.js | 12 +++++++----- webapp/src/components/Login.test.js | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/webapp/src/components/AddUser.test.js b/webapp/src/components/AddUser.test.js index c9f09b12..8a2dedc6 100644 --- a/webapp/src/components/AddUser.test.js +++ b/webapp/src/components/AddUser.test.js @@ -59,15 +59,17 @@ describe('AddUser component', () => { }); }); */ + +import AddUser from './AddUser'; import React from 'react'; import { render } from '@testing-library/react'; -import AddUser from './AddUser'; +import { BrowserRouter } from 'react-router-dom'; // Import BrowserRouter -describe('./AddUser', () => { - it('should render the component without crashing', () => { - // Render the component - render(); +describe('./AddUser', () => { + it('should render the Login component without crashing', () => { + // Wrap Login within BrowserRouter to provide routing context + render(); }); }); diff --git a/webapp/src/components/Login.test.js b/webapp/src/components/Login.test.js index 597d0149..e9b4a9ad 100644 --- a/webapp/src/components/Login.test.js +++ b/webapp/src/components/Login.test.js @@ -65,12 +65,12 @@ describe('Login component', () => { import React from 'react'; import { render } from '@testing-library/react'; -import Login from './Login';; +import { BrowserRouter } from 'react-router-dom'; // Import BrowserRouter +import Login from './Login'; // Assuming Login is the component under test describe('./Login', () => { - it('should render the component without crashing', () => { - // Render the component - render(); - + it('should render the Login component without crashing', () => { + // Wrap Login within BrowserRouter to provide routing context + render(); }); });