-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(GithubCard): add snapshot testing
- Loading branch information
1 parent
c19aa75
commit 061c6e1
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { render } from '@testing-library/react'; | ||
import GithubCard from './GithubCard'; | ||
|
||
describe('GithubCard', () => { | ||
const github = { | ||
profile: { | ||
username: 'sabertazimi', | ||
avatar: 'https://avatars.githubusercontent.com/u/12670482?v=4', | ||
bio: 'CS', | ||
location: 'Wuhan', | ||
url: 'https://github.com/sabertazimi', | ||
followers: 42, | ||
followersUrl: 'https://github.com/sabertazimi/followers', | ||
following: 185, | ||
followingUrl: 'https://github.com/sabertazimi/following', | ||
createDate: 'Sat May 30 2015', | ||
}, | ||
repos: [ | ||
{ | ||
name: 'hust-lab', | ||
stars: 22, | ||
language: 'C', | ||
repoUrl: 'https://github.com/sabertazimi/hust-lab', | ||
}, | ||
{ | ||
name: 'awesome-notes', | ||
stars: 22, | ||
language: 'JavaScript', | ||
repoUrl: 'https://github.com/sabertazimi/awesome-notes', | ||
}, | ||
{ | ||
name: 'dragon-zsh-theme', | ||
stars: 11, | ||
language: 'Zsh', | ||
repoUrl: 'https://github.com/sabertazimi/dragon-zsh-theme', | ||
}, | ||
], | ||
}; | ||
|
||
test('should render correctly (snapshot)', () => { | ||
const tree = renderer.create(<GithubCard github={github} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |