Skip to content

Commit

Permalink
added login and signup snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrowder65 committed Sep 28, 2019
1 parent a5fb83c commit 0830966
Show file tree
Hide file tree
Showing 10 changed files with 594 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
node_modules
coverage
/lib
/lib
*.cache
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"<rootDir>/test/config.js"
],
"transform": {
"^.+\\.js?$": "babel-jest"
"^.+\\.js?$": "babel-jest",
"^.+\\.md?$": "jest-raw-loader"
},
"coverageThreshold": {
"global": {
Expand All @@ -49,7 +50,8 @@
"lines": 100,
"statements": 100
}
}
},
"moduleFileExtensions": ["json", "js"]
},
"peerDependencies": {
"@material-ui/core": "3.9.2",
Expand All @@ -73,10 +75,14 @@
"jest": "24.4.0",
"jest-dom": "3.0.1",
"jest-localstorage-mock": "2.4.0",
"jest-raw-loader": "^1.0.1",
"react": "16.8.4",
"react-dom": "16.8.4",
"react-styleguidist": "9.0.4",
"react-testing-library": "6.0.0",
"sosia": "^1.2.5",
"sosia-markdown": "^1.1.1",
"sosia-puppeteer": "^1.1.0",
"webpack": "4.29.6"
},
"babelConfig": ".babelrc.js",
Expand Down
6 changes: 5 additions & 1 deletion src/Login.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
```js
### Login

This thing displays a login!

```jsx
<Login />
```
4 changes: 3 additions & 1 deletion src/Signup.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
```js
### Signup

```jsx
<Signup />
```
7 changes: 7 additions & 0 deletions src/__tests__/Login.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React from "react";
import { render } from "../../test/test-utils";
import Login from "../Login";
import markdown from "../Login.md";

test("that it renders without issues", () => {
render(<Login />);
});

const scope = { Login };

describe("it matches the visual snapshot", () => {
expect({ markdown, scope }).toMatchVisualSnapshot();
});
9 changes: 9 additions & 0 deletions src/__tests__/Signup.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import React from "react";
import { render } from "../../test/test-utils";
import Signup from "../Signup";
import markdown from "../Signup.md";

test("that it renders without errors", () => {
render(<Signup />);
});

const scope = { Signup };

describe("it matches the visual snapshot", () => {
describe("it matches the visual snapshot", () => {
expect({ markdown, scope }).toMatchVisualSnapshot();
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions test/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
require("jest-dom/extend-expect");
require("babel-polyfill");
require("react-testing-library/cleanup-after-each");
const { configure, toMatchVisualSnapshot } = require("sosia");
const { PuppeteerBrowserTarget } = require("sosia-puppeteer");
const { MarkdownSource } = require("sosia-markdown");

expect.extend({ toMatchVisualSnapshot });
configure({
targets: {
"chrome-desktop": new PuppeteerBrowserTarget({
width: 1024,
height: 768,
}),
},
sources: {
documentation: new MarkdownSource(),
},
});
Loading

0 comments on commit 0830966

Please sign in to comment.