Skip to content

Commit

Permalink
Merge pull request #7 from dcos-labs/danielmschmidt/DCOS-21785-jest
Browse files Browse the repository at this point in the history
Setup jest
  • Loading branch information
weblancaster authored Mar 27, 2018
2 parents cfe651a + bc0f0dd commit 5af78ff
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ serve
tmp/
.vscode/
.env
coverage

41 changes: 41 additions & 0 deletions components/badge/__snapshots__/badge.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Badge danger 1`] = `
<span
className="css-f00b3g"
>
danger
</span>
`;

exports[`Badge default 1`] = `
<span
className="css-b4fwwt"
>
default
</span>
`;

exports[`Badge information 1`] = `
<span
className="css-19f16re"
>
information
</span>
`;

exports[`Badge success 1`] = `
<span
className="css-1j3h1kw"
>
success
</span>
`;

exports[`Badge warning 1`] = `
<span
className="css-wz5vwa"
>
warning
</span>
`;
35 changes: 35 additions & 0 deletions components/badge/badge.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from "react";
import Badge from '../badge';
import renderer from 'react-test-renderer';

describe("Badge", () => {
it("default", () => {
expect(renderer
.create(<Badge>default</Badge>)
.toJSON()).toMatchSnapshot()
});

it("success", () => {
expect(renderer
.create(<Badge appearance="success">success</Badge>)
.toJSON()).toMatchSnapshot()
});

it("information", () => {
expect(renderer
.create(<Badge appearance="information">information</Badge>)
.toJSON()).toMatchSnapshot()
});

it("warning", () => {
expect(renderer
.create(<Badge appearance="warning">warning</Badge>)
.toJSON()).toMatchSnapshot()
});

it("danger", () => {
expect(renderer
.create(<Badge appearance="danger">danger</Badge>)
.toJSON()).toMatchSnapshot()
});
});
Loading

0 comments on commit 5af78ff

Please sign in to comment.