diff --git a/.eslintrc.json b/.eslintrc.json index 1c74457..236650b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -62,6 +62,7 @@ "@typescript-eslint/adjacent-overload-signatures": 0, "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-unnecessary-condition": 0, + "@typescript-eslint/no-namespace": 0, "react/no-unescaped-entities": 0, "react-hooks/exhaustive-deps": 0 } diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 598ab5f..c4aa34d 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -15,6 +15,23 @@ // Import commands.js using ES2015 syntax: import './commands'; +import { mount } from 'cypress/react18'; +import { ChakraProvider } from '@chakra-ui/react'; +import theme from '../../theme'; +import { createElement } from 'react'; +declare global { + namespace Cypress { + interface Chainable { + mount: typeof mount; + } + } +} + +Cypress.Commands.add('mount', (component, options) => { + const wrappedComponent = createElement(ChakraProvider, { theme }, component); + + return mount(wrappedComponent, options); +}); // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/src/pages/Book.tsx b/src/pages/Book.tsx index 9f96e96..9774f45 100644 --- a/src/pages/Book.tsx +++ b/src/pages/Book.tsx @@ -155,7 +155,7 @@ export default function Book() { bxSize: 5, }); - return navigate('/explore', { replace: true }); + navigate('/explore', { replace: true }); } function handleDeleteBook() {