This repository has been archived on 2026-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Operations-Research-Tool/__tests__/render_home_page.test.js
T
moebiusl 218d15ff51 Merge gmpl main2 (#37)
* addPage for gmpl

* implement gmpl full_functional

* final

* del unused variable

* change type of variable

* change test

* code fix

* code fix

* fixing var error (var -> let)

---------

Co-authored-by: SinusFox <61253950+SinusFox@users.noreply.github.com>
2024-10-11 23:25:56 +02:00

32 lines
934 B
JavaScript

import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import Home from '../src/app/page';
import { customLog, customLogClear } from '../src/app/scripts';
// Mock customLog and customLogClear
jest.mock('../src/app/scripts', () => ({
customLog: jest.fn(),
customLogClear: jest.fn(),
}));
// Mock next/navigation instead of next/router
jest.mock('next/navigation', () => ({
useRouter: jest.fn().mockReturnValue({
push: jest.fn(),
}),
}));
// Mock GLPKAPI to avoid issues with undefined LPF_ECOND
jest.mock('../src/solver/glpk.min.js', () => ({
LPF_ECOND: 2,
}));
test('render home page', () => {
// Render Home component
render(<Home />);
// Check if the heading text "OR-Tool" is present in the document
const headingElement = screen.getByText(/OR-Tool/i); // Match text that contains "OR-Tool"
expect(headingElement).toBeInTheDocument();
});