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

Replace tests with snapshot tests #48

Open
kazk opened this issue Oct 26, 2021 · 0 comments · May be fixed by #53
Open

Replace tests with snapshot tests #48

kazk opened this issue Oct 26, 2021 · 0 comments · May be fixed by #53
Assignees
Milestone

Comments

@kazk
Copy link
Member

kazk commented Oct 26, 2021

Replace

describe('%table-doc', () => {
  it('should render a table in HTML format', () => {
    const example = process(marked, fixture('table-doc')).html();
    expect(example).to.include('<td>id</td><td>INT</td>');
    expect(example).to.include('<td>title</td><td>VARCHAR(100)</td>');
    expect(example).to.include('<tr><td>email</td><td>VARCHAR(100)</td></tr>');
  });
});

with

describe('%table-doc', () => {
  it('should render a table in HTML format', () => {
    const example = process(marked, fixture('table-doc')).html();
    expect(format(example, { parser: 'html' })).toMatchSnapshot();
  });
});

by using Jest's expect and snapshot test. format is prettier.format.

This ensures the output doesn't change unintentionally.

@kazk kazk added this to the v1 milestone Oct 26, 2021
@kazk kazk self-assigned this Oct 26, 2021
@kazk kazk removed their assignment Nov 1, 2021
@kazk kazk self-assigned this Nov 30, 2021
@kazk kazk linked a pull request Feb 17, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant