make boilder plate react test happy with new dependencies

This commit is contained in:
Kurt Hutten IrevDev
2022-11-25 11:02:00 +11:00
parent b4f9e70752
commit e7e0f2a4fd
4 changed files with 19 additions and 7 deletions

View File

@ -30,7 +30,7 @@
}, },
"jest": { "jest": {
"transformIgnorePatterns": [ "transformIgnorePatterns": [
"node_modules/(?!(three)/)" "node_modules/(?!(three|allotment)/)"
] ]
}, },
"eslintConfig": { "eslintConfig": {

View File

@ -1,9 +1,19 @@
import React from 'react'; import React from "react";
import { render, screen } from '@testing-library/react'; import { render, screen } from "@testing-library/react";
import App from './App'; import App from "./App";
test('renders learn react link', () => { let listener: ((rect: any) => void) | undefined = undefined;
(global as any).ResizeObserver = class ResizeObserver {
constructor(ls: ((rect: any) => void) | undefined) {
listener = ls;
}
observe() {}
unobserve() {}
disconnect() {}
};
test("renders learn react link", () => {
render(<App />); render(<App />);
const linkElement = screen.getByText(/learn react/i); const linkElement = screen.getByText(/viewer/i);
expect(linkElement).toBeInTheDocument(); expect(linkElement).toBeInTheDocument();
}); });

View File

@ -2,7 +2,7 @@ import React, { useRef, useState, useEffect } from "react";
import { Canvas } from "@react-three/fiber"; import { Canvas } from "@react-three/fiber";
import { Allotment } from "allotment"; import { Allotment } from "allotment";
import { OrbitControls, OrthographicCamera } from "@react-three/drei"; import { OrbitControls, OrthographicCamera } from "@react-three/drei";
import "allotment/dist/style.css"; // import "allotment/dist/style.css";
import { lexer } from "./lang/tokeniser"; import { lexer } from "./lang/tokeniser";
import { abstractSyntaxTree } from "./lang/abstractSyntaxTree"; import { abstractSyntaxTree } from "./lang/abstractSyntaxTree";
import { executor } from "./lang/executor"; import { executor } from "./lang/executor";

View File

@ -2,6 +2,8 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@import '../node_modules/allotment/dist/style.css';
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',