Giter Site home page Giter Site logo

Comments (19)

killvung avatar killvung commented on September 7, 2024

I am interested at the issue, but have some questions regarding to the libraries we used for testing. I looked at the example file HelloWorld.spec.js, and learn that the test will mount an actual Vue component then verify the content through querySelector. Thought it's just an example, instead of querying each part for content, can we use
the library vue-test-utils along with jest snapshot? Documentation? This will make the unit tests more efficient. For example this is an example where I shallow render the SelectedLicense component, then capture the snapshot.

import { shallowMount } from '@vue/test-utils'
import SelectedLicense from '@/components/SelectedLicense'

describe('SelectedLicense', () => {
    it('should render correct contents', () => {
        const wrapper = shallowMount(SelectedLicense, {
            propsData: {
                fullLicenseName: '',
                shortLicenseName: ''
            }
        })
        expect(wrapper.element).toMatchSnapshot()
    })
})

snapshot

// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HelloWorld.vue should render correct contents 1`] = `
<div
  id="SelectedLicense"
>
  <div
    class="card chooser-selected"
  >
    <header
      class="card-header"
    >
      <h2
        class="title is-2"
      >
        Selected License
      </h2>
    </header>
     
    <div
      class="card-content"
    >
      <div>
        <licenseiconography-stub
          iconlist=","
        />
         
        <div
          class="selected-license-names"
        >
          <b
            class="selected-license-name"
          >
            
          </b>
           
          <a
            class="help"
            href="chooser.selected_license_link"
          >
            
          </a>
        </div>
      </div>
       
      <licensedescription-stub
        selectedlicense=""
      />
    </div>
  </div>
</div>
`;

from chooser.

akmadian avatar akmadian commented on September 7, 2024

You're all good to start working on this issue! I just pushed some changes, please pull them to your fork before getting started.

RE using vue-testing-utils, I think this should be alright. However, please make sure to not just test the template, also test that the content (license name(s), the link to the license info, etc.) is being tested as well.

Some things to keep in mind:

  • For components that require interaction, i.e. the IconSelector component, this will not replace nightwatch e2e testing.
  • The component will not work correctly if empty strings are passed as props. The props must be valid license names. I would like to see multiple license names being tested as well, not just cc by :)

from chooser.

deboragaleano avatar deboragaleano commented on September 7, 2024

Hi @akmadian, I'm an Outreachy applicant and was wondering if this issue has been assigned already. If not, I'b interested in working on it. Thank you!

from chooser.

killvung avatar killvung commented on September 7, 2024

I only have the discussion about the tools we can use for testing, so I haven't start picking up the issue yet. Feel free to claim it if you wish.

from chooser.

deboragaleano avatar deboragaleano commented on September 7, 2024

Thanks @killvung, I have just being assigned other issues so I give this back to you :)

from chooser.

akmadian avatar akmadian commented on September 7, 2024

Hey @killvung, I'm going to free this issue up for others to take a shot at since It's been a while since you've posted in this thread, and there's no activity on your fork of the repo.

from chooser.

obulat avatar obulat commented on September 7, 2024

Hi, @akmadian, can I take up this issue as well?
I'm also an Outreachy applicant, by the way.

from chooser.

akmadian avatar akmadian commented on September 7, 2024

@obulat, I’m going to say no for now to try and give someone else a shot at an issue in the repo since you’ve already done one

from chooser.

DevchamploO avatar DevchamploO commented on September 7, 2024

Hey @akmadian, I am an Outreachy applicant. Has this issue been assigned, I would like to work on it if available?

from chooser.

akmadian avatar akmadian commented on September 7, 2024

@DevchamploO go ahead :)

from chooser.

DevchamploO avatar DevchamploO commented on September 7, 2024

Thanks, I'll get started!

from chooser.

akmadian avatar akmadian commented on September 7, 2024

Hey @DevchamploO, if I don't see any indication of progress on this issue in the next two days, I'll have to free up the issue so that someone else can work on it.

from chooser.

akmadian avatar akmadian commented on September 7, 2024

I'm gonna free this issue up because there have been long periods of inactivity, with the only progress being made when I warned the assignee that I was going to free it up if I didn't see more progress soon.

from chooser.

onyijne avatar onyijne commented on September 7, 2024

@akmadian I have made a contribution during the contribution period, can I also contribute to this?

from chooser.

akmadian avatar akmadian commented on September 7, 2024

Yep, go ahead! @onyijne

from chooser.

onyijne avatar onyijne commented on September 7, 2024

okay will start right away

from chooser.

akmadian avatar akmadian commented on September 7, 2024

Hey @onyijne, I haven't seen any progress on this issue in about a week. Please make some more progress in the next couple days, or I will unassign you so others have a chance to contribute.

from chooser.

onyijne avatar onyijne commented on September 7, 2024

from chooser.

akmadian avatar akmadian commented on September 7, 2024

Closing because no longer relevant, most tests will need to be rewritten after the redesign is done.

from chooser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.