Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added first unit and integration tests #297

Merged
merged 4 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ firebase
*.jpeg
*.png
*.ico
*.snap
4 changes: 3 additions & 1 deletion web/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module.exports = {
// },
// },
transform: {
"^.+\\.(ts|tsx)?$": "ts-jest",
"^.+\\.(ts|tsx|js|jsx)?$": "ts-jest",
},
transformIgnorePatterns: ["node_modules/(?!react-syntax-highlighter)"],
coveragePathIgnorePatterns: ["node_modules", "dist"],
modulePaths: ["<rootDir>"],
};
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@material-ui/lab": "^4.0.0-alpha.57",
"@n8tb1t/use-scroll-position": "^2.0.3",
"@prettier/plugin-pug": "^1.13.1",
"@testing-library/react": "^11.2.6",
"@types/jest": "^26.0.19",
"@types/markdown-to-jsx": "^6.11.3",
"@types/react": "^17.0.0",
Expand Down
186 changes: 186 additions & 0 deletions web/src/apps/main/components/footer/__snapshots__/footer.spec.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`components/footer/footer.spec.tsx should render properly 1`] = `
<div>
<footer
class="makeStyles-root-1"
>
<div
class="MuiContainer-root MuiContainer-maxWidthLg css-cnms5y-MuiContainer-root"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-align-items-xs-flex-start"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-6 MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-md-9"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-direction-xs-column MuiGrid-grid-xs-12 MuiGrid-grid-md-6"
>
<h6
class="MuiTypography-root MuiTypography-h6 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-categoryTitle-3 css-2ulfj5-MuiTypography-root"
>
Helpful Links
</h6>
<a
href="/"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Home
</h6>
</a>
<a
href="/Learn"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Learn
</h6>
</a>
<a
href="/Projects"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Projects
</h6>
</a>
<a
href="/Articles"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Articles
</h6>
</a>
<a
href="/FAQ"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
FAQ
</h6>
</a>
</div>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-direction-xs-column MuiGrid-grid-xs-12 MuiGrid-grid-md-6"
>
<h6
class="MuiTypography-root MuiTypography-h6 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-categoryTitle-3 css-2ulfj5-MuiTypography-root"
>
Social Media
</h6>
<a
href="https://www.github.com/dzcode-io"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Github
</h6>
</a>
<a
href="https://join.slack.com/t/dzcode/shared_invite/zt-ek9kscb7-m8z_~cBjX79l~uchuABPFQ"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Slack
</h6>
</a>
<a
href="https://www.facebook.com/dzcode.io"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Facebook
</h6>
</a>
<a
href="https://www.instagram.com/dzcode.io"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Instagram
</h6>
</a>
<a
href="https://www.youtube.com/channel/UC_tLjuQaYotzERtaAo8Y4SQ"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
YouTube
</h6>
</a>
<a
href="https://twitter.com/dzcode_io"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
Twitter
</h6>
</a>
<a
href="https://www.linkedin.com/groups/8924363"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ati914-MuiTypography-root"
>
LinkedIn
</h6>
</a>
</div>
</div>
<div
class="MuiGrid-root makeStyles-contactDetails-4 MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-md-3"
>
<h6
class="MuiTypography-root MuiTypography-h6 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-categoryTitle-3 css-2ulfj5-MuiTypography-root"
>
Contact Information
</h6>
<a
href="tel:+21367-626-1157"
>
<p
class="MuiTypography-root MuiTypography-body1 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ahj2mt-MuiTypography-root"
>
+213 06-76-26-11-57
</p>
</a>
<a
href="mailto:[email protected]"
>
<p
class="MuiTypography-root MuiTypography-body1 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ahj2mt-MuiTypography-root"
>
[email protected]
</p>
</a>
<p
class="MuiTypography-root MuiTypography-body1 MuiTypography-colorInitial MuiTypography-alignInherit MuiTypography-displayInitial makeStyles-linkText-2 css-ahj2mt-MuiTypography-root"
>
Copyright ©
2021
<a
href="https://twitter.com/dzcode_io"
>
@dzCode_io
</a>
</p>
</div>
</div>
</div>
</footer>
</div>
`;
19 changes: 19 additions & 0 deletions web/src/apps/main/components/footer/footer.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Footer } from ".";
import { Provider } from "react-redux";
import { BrowserRouter as Router } from "react-router-dom";
import { createMainStore } from "src/apps/main/redux";
import { render } from "@testing-library/react";

describe("components/footer/footer.spec.tsx", () => {
test("should render properly", () => {
const mainStore = createMainStore();
const { container } = render(
<Provider store={mainStore}>
<Router>
<Footer />
</Router>
</Provider>,
);
expect(container).toMatchSnapshot();
});
});
48 changes: 20 additions & 28 deletions web/src/apps/main/components/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,26 @@ export const Footer: FC = () => {
alignContent="stretch"
>
<Grid container item xs={12} md={9} spacing={6}>
{sections
? sections.map((category, i) => (
<Grid
direction="column"
container
item
xs={12}
md={6}
key={i}
>
<Typography variant="h6" className={classes.categoryTitle}>
{category.title}
</Typography>
{category.links.map((link, i) => {
return (
<LinkV2 key={i} href={link.href}>
<Typography
variant="subtitle2"
className={classes.linkText}
>
{link.text}
</Typography>
</LinkV2>
);
})}
</Grid>
))
: null}
{sections &&
sections.map((category, i) => (
<Grid direction="column" container item xs={12} md={6} key={i}>
<Typography variant="h6" className={classes.categoryTitle}>
{category.title}
</Typography>
{category.links.map((link, i) => {
return (
<LinkV2 key={i} href={link.href}>
<Typography
variant="subtitle2"
className={classes.linkText}
>
{link.text}
</Typography>
</LinkV2>
);
})}
</Grid>
))}
</Grid>
<Grid item xs={12} md={3} className={classes.contactDetails}>
<Typography variant="h6" className={classes.categoryTitle}>
Expand Down
Loading