Skip to content

Commit

Permalink
Merge pull request #8 from Newspaper-Advertisement-Analyzer/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
TharinduMadhusanka authored Oct 16, 2023
2 parents 41ea820 + 032b2d1 commit c258b2f
Show file tree
Hide file tree
Showing 46 changed files with 1,481 additions and 160 deletions.
74 changes: 37 additions & 37 deletions .firebase/hosting.YnVpbGQ.cache
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ brand-dark.png,1694254597736,702452b4806f73230e4931aa592272e2b575041e860562fa40f
favicon.png,1691226006659,98a04f7e56d94a7501464028a58de35b8c75edd22190662dd1c9a7d4506f9011
manifest.json,1694287199372,c83ecda918bbbda0c2ddf51f5dc7a3a681e7ce84438985e201e7a843e8f47ec9
robots.txt,1691226006661,b2090cf9761ef60aa06e4fab97679bd43dfa5e5df073701ead5879d7c68f1ec5
asset-manifest.json,1696704887805,0d13e7a32d08d695f4b747318eb053620d05d83576e75808a6878fc13f912960
index.html,1696704887742,525ad697503150d7f3c27ebd21123bde910e4236c9cf7e8e62d5d89f84753170
static/css/main.21be9e29.css,1696704887747,055e9e85a0610e176e38ad174690ec4ff6808dd57ce88dbc54175c0171a16476
static/css/main.21be9e29.css.map,1696704887805,386851af591d5f1544327c513e505eaf17e86e607bf4af9d607488d2db10b9c6
static/js/703.68ff776a.chunk.js,1696704887805,e83256c6d19bf02880f9ae9f36584c69b9e491beecec0ceb1c5ac14b85c882e3
static/js/703.68ff776a.chunk.js.LICENSE.txt,1696704887745,3d8cec7287cdb0530baa88a78b7810defffd2f56cc2cccf447bc5889a622b212
static/js/main.9796e417.js.LICENSE.txt,1696704887745,20488bf5da16a483592651d1696300dd006944aa4bba15bece1383c3119057f9
static/media/icon-blacklist.00461066f8dc77314608696b24ffca29.svg,1696704887727,23ec3e3fe5106041541173ea5bd667cebac2d62471759db00f4a4f9a99b65a8e
static/media/icon-facebook.7e5a10f05d754f6e65372e20a5452d60.svg,1696704887729,e886d6d8420e8ea3f5d92b3e4411d690cbf59db4b1c32c6baaf7fe0faebc1847
static/media/icon-instagram.6916c290ec7f973be569508e95332846.svg,1696704887730,63d77fac1a784b57ac66383f2265c103bcdc61bb484ff50b344b970473ea452a
static/media/icon-preview.9d260cdcabe46fdc423492bfe2e317cf.svg,1696704887729,2e1fc9d039149ef375d54d7276089c55ff21f2504139c79859349613a6b31619
static/media/icon-text.72e88c25f84b1cf1d3f69a697f689f64.svg,1696704887727,8c54c677a8fc3e9d0b054ebf7a46ae3573df7219603b04d736099fba7ea51efc
static/media/icon-twitter.09334153919ab7925dce3b54b4b9a815.svg,1696704887731,76bca9231586ca4c6fd04e7a2740cf1b0bdf8699094689df819e0eb50d57a3b2
static/media/bruce-mars.8a606c4a6dab54c9ceff.jpg,1696704887731,b9d6660122b20a8a6fb1b6e7ea4d9b575b2ed1e9d86fe66e9ef7bbbc4804b964
static/media/house.ce4190cf14822c2257b0.png,1696704887742,71651ecfee60076c2d84abd0128f2716b944250d4f529224f2724db4ebfcdb29
static/media/logowithbrand.1e0479210ed4f2cd2af0.png,1696704887745,f1be59932f15bcc82152ef5f33a69abebcdb1ef28d5b929805acaf810ba17758
static/js/703.68ff776a.chunk.js.map,1696704887806,5a0ff7437240593cc20bb51e55130a6d746b07e30495804530095587227ce082
static/media/land.a180af0f55ec7508e106.png,1696704887742,ea3f98c35afa9311618ee456466cbc0e1927b4488fa6d7026c902146e597868c
static/media/marriage.7b26dbac84b6fb70b91e.png,1696704887742,eefda79f94949d6e5dfdfbeba1c84cbb8101058ff92e3131e7da6b562711f2e5
static/media/mastercard.27fca3e7637a9458fb64.png,1696704887732,2015bca51ddb5859ebb94d73d1802bf322d2f7e544c0a2fbc3500fd992af8500
static/media/visa.71c0d5e9e2aaee42e4c3.png,1696704887732,5675d0bb0a46ef1c343090c0b9ba4d2b398c937b72909a7fcd1c959e36dc784f
static/js/513.c3183f67.chunk.js,1696704887806,3ffbee61e1e12b2ac876d96a8aa82288d705827c4bd232805d09e4d26b19f184
static/media/image-devices.7a9f93355333984b7941.png,1696704887744,db97ae84ccd9a09052017c203e159e7f57d14b473ce5d6095f4b2ff31a047ef8
static/media/bg-header-desktop.3d39ff8e4eec581d1f91.png,1696704887730,6a8849446474587badf86ebf0d58bcf72aef1a680157d90c7cf5b471647da918
static/media/image-computer.65db67db202be4e74616.png,1696704887744,a221118a6e05fc3c24fd4b56839206ab412de9339a853610d20ad142fac73e53
static/js/513.c3183f67.chunk.js.map,1696704887807,0d4d4ba2f497ad3d0cb01e42846812c45900da1978e557b7a5301f8159fb8f5b
static/media/bg-profile.af1219a742e09fc7b612.jpeg,1696704887731,c0224651329e6f23cbe3bd9bfb37986a67de3566a837197af7ba31eb5bf2a928
static/media/house (1).1c4662866d6ca3755cf4.jpg,1696704887731,8610be21401a79ecd5b0448b81190772e7b6e2504a455c9eaf6eb5d2982bb044
static/media/wedding.72b9ec574465c95d19b9.jpg,1696704887744,c45f2c6592cab0cd42dd8d03cab88adaf91ce7aa2ecbf707fa93ca6fa84cfe1f
static/media/newspaper2.d4dec8c732058acfeec1.jpg,1696704887743,3a7a10c19aa48d4ad2c2678da165da3a0d59dd6ef638b2e71cb3af37928b83fa
static/media/background3.3ce0efefbd5f55c07b58.png,1696704887745,4b0f57791be4038375c5d4c7039357793e0c19837615de31b2b8ee60a3aedfc9
static/media/land.545d66910852fb567f29.jpg,1696704887734,b76f1b1f28de91e7e91995c23f05d6dc5d77035402e3f1034be96384f6ec1004
static/js/main.9796e417.js,1696704887807,6a93e135bacf08539a817d5b74177e66d6c95936338bf7941548aa52055bad70
static/media/pattern-tree.431da656681abcdffac51bee04d7f581.svg,1696704887743,077b4cad6cd72eaf768124ce97b66451dabf05a04e422c8cb4452f887b8b8ebb
static/media/background.b28e08e8c97c1c73b13f.jpg,1696704887731,364ba257eb402e2e6a69bfd7544679734f3c62a719f015fa6c499238f87e9b1a
static/media/newspaper1.d9cb92762b7f143bf29b.jpg,1696704887746,dbd7a8fdf1f7f03040c6e6c8dc5d13e3726fc1b243ebeea59e9ceb35e7936e42
static/js/main.9796e417.js.map,1696704887813,16f3e75cd0dcb91e6baf33f7b79310c5a29103b5c624c77a2aa56f4f50fe0992
asset-manifest.json,1696732173023,23407ac00406df72732414da475e93139a9b2962c54ec9199451e48c7f893d4f
index.html,1696732171508,d6294f31c38bc467079eee92494e8d1ee34cfafd52f142717d3c5c0178576dc3
static/css/main.21be9e29.css,1696732172843,055e9e85a0610e176e38ad174690ec4ff6808dd57ce88dbc54175c0171a16476
static/js/703.68ff776a.chunk.js.LICENSE.txt,1696732171524,3d8cec7287cdb0530baa88a78b7810defffd2f56cc2cccf447bc5889a622b212
static/js/703.68ff776a.chunk.js,1696732172843,e83256c6d19bf02880f9ae9f36584c69b9e491beecec0ceb1c5ac14b85c882e3
static/css/main.21be9e29.css.map,1696732173022,386851af591d5f1544327c513e505eaf17e86e607bf4af9d607488d2db10b9c6
static/js/main.3a0a9926.js.LICENSE.txt,1696732172706,20488bf5da16a483592651d1696300dd006944aa4bba15bece1383c3119057f9
static/media/icon-facebook.7e5a10f05d754f6e65372e20a5452d60.svg,1696732171468,e886d6d8420e8ea3f5d92b3e4411d690cbf59db4b1c32c6baaf7fe0faebc1847
static/media/icon-instagram.6916c290ec7f973be569508e95332846.svg,1696732171474,63d77fac1a784b57ac66383f2265c103bcdc61bb484ff50b344b970473ea452a
static/media/icon-blacklist.00461066f8dc77314608696b24ffca29.svg,1696732171474,23ec3e3fe5106041541173ea5bd667cebac2d62471759db00f4a4f9a99b65a8e
static/media/icon-preview.9d260cdcabe46fdc423492bfe2e317cf.svg,1696732171467,2e1fc9d039149ef375d54d7276089c55ff21f2504139c79859349613a6b31619
static/media/icon-text.72e88c25f84b1cf1d3f69a697f689f64.svg,1696732171495,8c54c677a8fc3e9d0b054ebf7a46ae3573df7219603b04d736099fba7ea51efc
static/media/icon-twitter.09334153919ab7925dce3b54b4b9a815.svg,1696732171468,76bca9231586ca4c6fd04e7a2740cf1b0bdf8699094689df819e0eb50d57a3b2
static/media/house.ce4190cf14822c2257b0.png,1696732171474,71651ecfee60076c2d84abd0128f2716b944250d4f529224f2724db4ebfcdb29
static/media/logowithbrand.1e0479210ed4f2cd2af0.png,1696732172706,f1be59932f15bcc82152ef5f33a69abebcdb1ef28d5b929805acaf810ba17758
static/js/703.68ff776a.chunk.js.map,1696732173225,5a0ff7437240593cc20bb51e55130a6d746b07e30495804530095587227ce082
static/media/land.a180af0f55ec7508e106.png,1696732171507,ea3f98c35afa9311618ee456466cbc0e1927b4488fa6d7026c902146e597868c
static/media/mastercard.27fca3e7637a9458fb64.png,1696732171469,2015bca51ddb5859ebb94d73d1802bf322d2f7e544c0a2fbc3500fd992af8500
static/media/marriage.7b26dbac84b6fb70b91e.png,1696732171507,eefda79f94949d6e5dfdfbeba1c84cbb8101058ff92e3131e7da6b562711f2e5
static/media/visa.71c0d5e9e2aaee42e4c3.png,1696732171471,5675d0bb0a46ef1c343090c0b9ba4d2b398c937b72909a7fcd1c959e36dc784f
static/js/513.c3183f67.chunk.js,1696732173022,3ffbee61e1e12b2ac876d96a8aa82288d705827c4bd232805d09e4d26b19f184
static/media/image-devices.7a9f93355333984b7941.png,1696732172843,db97ae84ccd9a09052017c203e159e7f57d14b473ce5d6095f4b2ff31a047ef8
static/media/bg-header-desktop.3d39ff8e4eec581d1f91.png,1696732171468,6a8849446474587badf86ebf0d58bcf72aef1a680157d90c7cf5b471647da918
static/media/image-computer.65db67db202be4e74616.png,1696732171597,a221118a6e05fc3c24fd4b56839206ab412de9339a853610d20ad142fac73e53
static/media/socrates.8e85b668f6e9feea1255.jpeg,1696732171509,49aebb9fb695625ea2937ec9693a0afa883eacefd02d712d69bc0d5ab7b3cc67
static/js/513.c3183f67.chunk.js.map,1696732173225,0d4d4ba2f497ad3d0cb01e42846812c45900da1978e557b7a5301f8159fb8f5b
static/media/bg-profile.af1219a742e09fc7b612.jpeg,1696732171469,c0224651329e6f23cbe3bd9bfb37986a67de3566a837197af7ba31eb5bf2a928
static/media/house (1).1c4662866d6ca3755cf4.jpg,1696732171474,8610be21401a79ecd5b0448b81190772e7b6e2504a455c9eaf6eb5d2982bb044
static/media/wedding.72b9ec574465c95d19b9.jpg,1696732171512,c45f2c6592cab0cd42dd8d03cab88adaf91ce7aa2ecbf707fa93ca6fa84cfe1f
static/media/newspaper2.d4dec8c732058acfeec1.jpg,1696732171523,3a7a10c19aa48d4ad2c2678da165da3a0d59dd6ef638b2e71cb3af37928b83fa
static/media/background3.3ce0efefbd5f55c07b58.png,1696732171523,4b0f57791be4038375c5d4c7039357793e0c19837615de31b2b8ee60a3aedfc9
static/media/land.545d66910852fb567f29.jpg,1696732171471,b76f1b1f28de91e7e91995c23f05d6dc5d77035402e3f1034be96384f6ec1004
static/js/main.3a0a9926.js,1696732173023,3ff2b97fad930d8d77cdf81ceceed8082ad1643cf3c73c5cf28044603b11ef58
static/media/pattern-tree.431da656681abcdffac51bee04d7f581.svg,1696732171495,077b4cad6cd72eaf768124ce97b66451dabf05a04e422c8cb4452f887b8b8ebb
static/media/background.b28e08e8c97c1c73b13f.jpg,1696732171472,364ba257eb402e2e6a69bfd7544679734f3c62a719f015fa6c499238f87e9b1a
static/media/newspaper1.d9cb92762b7f143bf29b.jpg,1696732171512,dbd7a8fdf1f7f03040c6e6c8dc5d13e3726fc1b243ebeea59e9ceb35e7936e42
static/js/main.3a0a9926.js.map,1696732174557,eb471357af0683df418a5be12130ab6da81e0b659fd311016c1c762542f27bdb
97 changes: 94 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"react-router-dom": "6.11.0",
"react-scripts": "5.0.1",
"react-table": "7.8.0",
"selenium-webdriver": "^4.14.0",
"stylis": "4.1.4",
"stylis-plugin-rtl": "2.1.1",
"uuid": "^9.0.0",
Expand All @@ -52,7 +53,7 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!axios)/\"",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand Down
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { useMaterialUIController, setMiniSidenav, setOpenConfigurator } from "co
import brandWhite from "assets/images/brand-dark.png";
import brandDark from "assets/images/brand-light.png";
import Background from "examples/LayoutContainers/background";
import bgImage from "layouts/landing/Assets/images/background3.png";
// import bgImage from "layouts/landing/Assets/images/background3.png";
import { useUser } from "utils/userContext";

export default function App() {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function App() {

return (
<ThemeProvider theme={darkMode ? themeDark : theme}>
<Background image={bgImage}>
<Background>
<CssBaseline />
{layout === "dashboard" && (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/__test__/Login.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ jest.mock("react-router-dom", () => ({
describe("Sign In Page", () => {
it("handles login correctly", () => {
render(
<MemoryRouter>
<BrowserRouter>
<MaterialUIControllerProvider>
<UserProvider>
<ThemeProvider theme={theme}>
<Basic />
</ThemeProvider>
</UserProvider>
</MaterialUIControllerProvider>
</MemoryRouter>
</BrowserRouter>
);

// Mock the fetch function to handle the login request
Expand Down
82 changes: 82 additions & 0 deletions src/__test__/adCard.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { AdCard } from "layouts/dashboard/components/adCard"; // adjust the import path accordingly
import { BrowserRouter } from "react-router-dom";
import { MaterialUIControllerProvider } from "context";
import UserProvider from "utils/userContext";
import { ThemeProvider } from "@mui/material";
import theme from "assets/theme";

// Mock the data you expect to receive from the backend
const mockBackendData = [
{
Advertisement_ID: 1,
category: "Land Sale",
Title: "Sample Land Ad",
Description: "This is a land ad description",
},
{
Advertisement_ID: 2,
category: "House Sale",
Title: "Sample House Ad",
Description: "This is a house ad description",
},
{
Advertisement_ID: 3,
category: "Marriage Proposal",
Title: "Sample Marriage Ad",
Description: "This is a marriage ad description",
},
];

// Mock the getPopularAd function
jest.mock("api/advertisemntCards/advertisementCard", () => ({
getPopularAd: jest.fn(() => Promise.resolve(mockBackendData)),
}));
export const getPopularAd = jest.fn().mockImplementation(() => {
const data = {
category: "Land Sale",
title: "Sample Land Ad",
description: "This is a land ad description",
};

// Log the data before returning it
console.log("Mocked API data:", data);

return data;
});
test("renders AdCard component with data", async () => {
// Render the AdCard component
const { getByText, getByAltText } = render(
<BrowserRouter>
<MaterialUIControllerProvider>
<UserProvider>
<ThemeProvider theme={theme}>
<AdCard />
</ThemeProvider>
</UserProvider>
</MaterialUIControllerProvider>
</BrowserRouter>
);

// Check if loading spinner is displayed
const loadingElement = getByText("Recent Advertisements");
expect(loadingElement).toBeInTheDocument();

// Wait for the data to load (you might want to add a loading state to your component)
await waitFor(() => {
const title = screen.getByText("Land Sale");
expect(title).toBeInTheDocument();
});
const title = screen.getByText("Sample Land Ad");
const description = screen.getByText("This is a land ad description");
const image = screen.getByAltText("Land Sale");

// You can add more assertions for other data elements

expect(category).toBeInTheDocument();
expect(title).toBeInTheDocument();
expect(description).toBeInTheDocument();
expect(image).toBeInTheDocument();
});
Loading

0 comments on commit c258b2f

Please sign in to comment.