39% but error

This commit is contained in:
iliyasone 2024-10-19 10:57:44 +03:00
parent 5f386c0f4e
commit 79289457c9
6 changed files with 11 additions and 6 deletions

1
__mocks__/fileMock.js Normal file
View File

@ -0,0 +1 @@
module.exports = 'test-file-stub';

View File

@ -3,7 +3,7 @@ import { render, screen } from "@testing-library/react";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
import configureStore from "redux-mock-store"; import configureStore from "redux-mock-store";
import Home from "src/pages/Home"; import Home from "src/pages/Home";
import { useGetChatsQuery } from "../backend/redux/api_slice"; import { useGetChatsQuery } from "src/backend/redux/api_slice";
// Mock Redux store // Mock Redux store
const mockStore = configureStore([]); const mockStore = configureStore([]);

View File

@ -1,14 +1,14 @@
import React from "react"; import React from "react";
import { render, screen, fireEvent } from "@testing-library/react"; import { render, screen, fireEvent } from "@testing-library/react";
import SignIn from "../pages/SignIn"; import SignIn from "src/pages/SignIn";
import { displayMessage } from "../backend/notifications/notifications"; import { displayMessage } from "src/backend/notifications/notifications";
import { post } from "../backend/api"; import { post } from "src/backend/api";
// Mock the displayMessage and post functions // Mock the displayMessage and post functions
jest.mock("../backend/notifications/notifications", () => ({ jest.mock("src/backend/notifications/notifications", () => ({
displayMessage: jest.fn(), displayMessage: jest.fn(),
})); }));
jest.mock("../backend/api", () => ({ jest.mock("src/backend/api", () => ({
post: jest.fn(), post: jest.fn(),
})); }));

View File

@ -20,6 +20,7 @@ const config: Config = {
moduleNameMapper: { moduleNameMapper: {
"^@/src/(.*)$": "<rootDir>/src/$1", // Map '@/src' to the 'src' folder "^@/src/(.*)$": "<rootDir>/src/$1", // Map '@/src' to the 'src' folder
"^src/(.*)$": "<rootDir>/src/$1", // Map 'src' to the 'src' folder "^src/(.*)$": "<rootDir>/src/$1", // Map 'src' to the 'src' folder
"\\.(svg|png|jpg|jpeg|gif)$": "<rootDir>/__mocks__/fileMock.js", // Add this line
}, },
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx', 'js', 'jsx'],
}; };

View File

@ -9,6 +9,9 @@ jest.mock('@brojs/cli', () => {
}, },
getNavigationsValue(key) { getNavigationsValue(key) {
return mockedConfig.navigations[key] return mockedConfig.navigations[key]
},
getConfigValue(key) {
return mockedConfig.config[key]
} }
} }
}) })

BIN
src.zip

Binary file not shown.