Skip to content

Commit

Permalink
test(a-button): 增加 NewBtn 测试
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed Jan 6, 2022
1 parent 768a645 commit 2a4a20a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions __tests__/NewBtn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {NewBtn} from '../';
import {MemoryRouter} from 'react-router';
import {render} from '@testing-library/react';

describe('NewBtn', () => {
test('default', () => {
const {container} = render(<MemoryRouter>
<NewBtn href="foo">bar</NewBtn>
</MemoryRouter>);

expect(container).toMatchSnapshot();
});

test('text', () => {
const {container} = render(<MemoryRouter>
<NewBtn data-testid="foo" href="foo">bar</NewBtn>
</MemoryRouter>);

expect(container).toMatchSnapshot();
});
});
28 changes: 28 additions & 0 deletions __tests__/__snapshots__/NewBtn.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NewBtn default 1`] = `
<div>
<a
class="ant-btn ant-btn-success"
href="foo"
>
<span>
bar
</span>
</a>
</div>
`;

exports[`NewBtn text 1`] = `
<div>
<a
class="ant-btn ant-btn-success"
data-testid="foo"
href="foo"
>
<span>
bar
</span>
</a>
</div>
`;

0 comments on commit 2a4a20a

Please sign in to comment.