39% but error
This commit is contained in:
parent
5f386c0f4e
commit
79289457c9
1
__mocks__/fileMock.js
Normal file
1
__mocks__/fileMock.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'test-file-stub';
|
@ -3,7 +3,7 @@ import { render, screen } from "@testing-library/react";
|
||||
import { Provider } from "react-redux";
|
||||
import configureStore from "redux-mock-store";
|
||||
import Home from "src/pages/Home";
|
||||
import { useGetChatsQuery } from "../backend/redux/api_slice";
|
||||
import { useGetChatsQuery } from "src/backend/redux/api_slice";
|
||||
|
||||
// Mock Redux store
|
||||
const mockStore = configureStore([]);
|
||||
|
@ -1,14 +1,14 @@
|
||||
import React from "react";
|
||||
import { render, screen, fireEvent } from "@testing-library/react";
|
||||
import SignIn from "../pages/SignIn";
|
||||
import { displayMessage } from "../backend/notifications/notifications";
|
||||
import { post } from "../backend/api";
|
||||
import SignIn from "src/pages/SignIn";
|
||||
import { displayMessage } from "src/backend/notifications/notifications";
|
||||
import { post } from "src/backend/api";
|
||||
|
||||
// Mock the displayMessage and post functions
|
||||
jest.mock("../backend/notifications/notifications", () => ({
|
||||
jest.mock("src/backend/notifications/notifications", () => ({
|
||||
displayMessage: jest.fn(),
|
||||
}));
|
||||
jest.mock("../backend/api", () => ({
|
||||
jest.mock("src/backend/api", () => ({
|
||||
post: jest.fn(),
|
||||
}));
|
||||
|
||||
|
@ -20,6 +20,7 @@ const config: Config = {
|
||||
moduleNameMapper: {
|
||||
"^@/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'],
|
||||
};
|
||||
|
@ -9,6 +9,9 @@ jest.mock('@brojs/cli', () => {
|
||||
},
|
||||
getNavigationsValue(key) {
|
||||
return mockedConfig.navigations[key]
|
||||
},
|
||||
getConfigValue(key) {
|
||||
return mockedConfig.config[key]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user