Skip to content

Commit

Permalink
mock modal to please tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sroertgen committed Sep 4, 2023
1 parent 745b73a commit 9301205
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useRef } from "react"
import { css } from "@emotion/react"

function Modal({ openModal, closeModal, children }) {
const Modal = ({ openModal, closeModal, children }) => {
const style = css`
dialog {
border: none;
Expand Down
5 changes: 5 additions & 0 deletions test/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ function renderApp(history, pageContext, children = null) {

describe("App", () => {
vi.spyOn(window, "fetch").mockImplementation(mockFetch)
vi.mock("../src/components/Modal.jsx", async () => {
return {
default: () => <div></div>,
}
})
useStaticQuery.mockImplementation(() => mockConfig)

it("renders App component with expand and collapse button", async () => {
Expand Down

0 comments on commit 9301205

Please sign in to comment.