From a21da9cf731c24c7165ceadf0b3c8e63a30d743e Mon Sep 17 00:00:00 2001 From: Matheusafonsouza Date: Sun, 8 Dec 2024 17:22:54 -0300 Subject: [PATCH] fix: tests for app Co-Authored-By: Joaovitor045 Co-Authored-By: gsVieiraaa --- jest.setup.ts | 12 ++++++++++++ test/App.spec.tsx | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/jest.setup.ts b/jest.setup.ts index d0de870..8dba218 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -1 +1,13 @@ import "@testing-library/jest-dom"; + +if ( + typeof globalThis.TextEncoder === "undefined" || + typeof globalThis.TextDecoder === "undefined" +) { + const utils = require("util"); + globalThis.TextEncoder = utils.TextEncoder; + globalThis.TextDecoder = utils.TextDecoder; + globalThis.Uint8Array = Uint8Array; +} + +global.structuredClone = (val) => JSON.parse(JSON.stringify(val)) diff --git a/test/App.spec.tsx b/test/App.spec.tsx index bae5b7e..0301943 100644 --- a/test/App.spec.tsx +++ b/test/App.spec.tsx @@ -2,9 +2,7 @@ import React from "react"; import '@testing-library/jest-dom' import { render } from "@testing-library/react" import App from "../src/App" -test('demo', () => { - expect(true).toBe(true) -}) + test("Renders the main page", () => { render() expect(true).toBeTruthy()