Skip to content

How would you simplify this unit tested Vue component? #1752

Answered by freakzlike
targetlucked69 asked this question in Q&A
Discussion options

You must be logged in to vote

Doesn't look too bad for me. I personally would group them to have a better overview what is related to that specific test case:

describe('<AppCard />', () => {
  /**
   * Header
   */
  describe('header', () => {
    it('renders element within .card-header', () => {
      const wrapper = mount(AppCard, {
        slots: {
          header: '<div>Header</div>'
        }
      })

      expect(wrapper.find('.card-header').text()).toBe('Header')
    })

    it('removes .card-header when no element is passed', () => {
      const wrapper = mount(AppCard)

      expect(wrapper.find('.card-header').exists()).toBe(false)
    })
  })

  /**
   * Content
   */
  describe('content', () => {
    it('…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@targetlucked69
Comment options

Answer selected by targetlucked69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants