Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
how to test vue.js component with jest in the following case ( Data() are passed from the Backend )?

We have the following vue.js component and the goal is to test article.title if it's working properly. We have the test Class Gridcard.spec.js for using jest for testing. the Data() that are passed from the Backend from the class Article has the following attributes **article.id** **article.title** **article.text** **article.points**

<template>
  <div  class="col"  v-for= " article in articles" v-bind:key= "article.lid" >
      <h5 class="card-title"> {{ article.title }}</h5>
  </div>
</template>

<script>
export default {
  name: 'Gridcard',
  props: {
    title: String
  },
  components: { },
  data () {
    return {
      articles: [],
    }
  },
  methods: {
   
  mounted () {
    const base = process.env.VUE_APP_BACKEND_BASE_URL + '/api/v1/article'
    const requestOptions = {
      method: 'GET',
      redirect: 'follow'
    }

    fetch(base, requestOptions)
      .then(response => response.json())
      .then(result => result.forEach(article=> {
        this.articles.push(article)
      }))
      .catch(error => console.log('error', error))
  }
}

</script>

<style scoped>

</style>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!