Skip to content

Some Vue components tests are erroneous #2610

Description

@gerteck

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

No

Environment: Win 11
MarkBind version: 5.3.3

Describe the bug and the steps to reproduce it

Several vue-component tests are erroneous.

See:

test('with no-background option does not affect background-color', () => {
const wrapper = mount(Box, {
propsData: {
noBackground: true,
backgroundColor: 'yellow',
},
});
const boxYellowBackground = mount(Box, {
propsData: {
backgroundColor: 'yellow',
},
});
expect(wrapper).toEqual(boxYellowBackground);
});

Actually, only the wrapper is being compared. So the test is not really testing anything. For instance, you could even mount a different component and the test would pass.

Image

Other things:

  • If facing issues getting the jest to compile, try removing your jest cache. npx jest --clearCache. Faced this issue, but could be because I have been swapping configurations between Vue 2 and Vue 3.
  • To run individual tests, the path (e.g. npm test ./src/__tests__/Box.spec.js needs to be delimited by / not \. For case of autocomplete path on windows. (Bc. of default test regex).

Other components:

Breadcrumbs

const SITENAV_START = `
<nav id="site-nav">
<div class="nav-component slim-scroll>
<div class="site-nav-root">
<ul class="site-nav-list site-nav-list-root">
`;

On line 7 the class is actually not closed.

Popovers

Some of the snapshot tests for popovers don't really seem to test functionality rather than just testing on the surface given the stubs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions