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

test(footer): add unit test #794

Merged
merged 2 commits into from
Aug 25, 2022
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 src/footer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ spline: data
isComponent: true
---

<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-0%25-red" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-0%25-red" /></span>
## 引入

全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
Expand Down
17 changes: 17 additions & 0 deletions src/footer/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Footer :base 1`] = `
<main>
<main>
<wx-view
class="t-footer"
>
<wx-view
class="t-footer__copyright-info"
>

</wx-view>
</wx-view>
</main>
</main>
`;
21 changes: 21 additions & 0 deletions src/footer/__test__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import simulate from 'miniprogram-simulate';
import path from 'path';

describe('Footer', () => {
const footer = simulate.load(path.resolve(__dirname, `../footer`), {
less: true,
});

it(':base', () => {
const id = simulate.load({
template: `<t-footer></t-footer>`,
usingComponents: {
't-footer': footer,
},
});
const comp = simulate.render(id);
comp.attach(document.createElement('parent-wrapper'));

expect(comp.toJSON()).toMatchSnapshot();
});
});