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

Question: testing and covering shapes with jest #78

Open
ChriBack opened this issue Mar 2, 2021 · 1 comment
Open

Question: testing and covering shapes with jest #78

ChriBack opened this issue Mar 2, 2021 · 1 comment
Assignees

Comments

@ChriBack
Copy link

ChriBack commented Mar 2, 2021

Hi,

I am new to vue-types and developing in a project with testing and code coverage with jest.
My problem ist, that jest/istanbul is telling me that "function not covered" when it comes to shapes.

image
In the image you can see the problem.
the vue component looks like this

import VueTypes from 'vue-types';
import { contractStatus } from '@/global-js/mappings';

export default {
  name: 'BankAccountEditListContractStatus',

  props: {
    status: VueTypes.shape({
      color: VueTypes.oneOf(Object.keys(contractStatus)).isRequired,
      tooltip: VueTypes.string,
    }).def(() => ({ tooltip: '' })),
    power: VueTypes.string.isRequired,
    tooltipPrice: VueTypes.string.def(''),
  },

  computed: {
    statusClass() {
      return `is-${contractStatus[this.status.farbe].color}`;
    },
  },
}

Any thoughts on how i can cover this?

Thank you in advance

@dwightjack
Copy link
Owner

Hi,

sorry for the late reply. I am not that familiar with jest code coverage to tell why it thinks that the prop is not covered.

If it was the def arrow function, you could change it to .def({ tooltip: '' }) (vue-types makes a shallow copy internally), but I am not sure it will fix your issue.

@dwightjack dwightjack self-assigned this Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants