Я не уверен, как смоделировать этот вызов API в unit-test
для Vue
Что меня отталкивает, так это переменные, составляющие URL API.
export default {
name: "Jobs",
data() {
return {
job_execs: []
}
},
created() {
this.JobExecEndpoint = process.env.VUE_APP_UATU_URL + '/api/v1/job_execution/?tool='+this.$route.params.tool+'&job='+this.$route.params.job+'&id='+this.$route.params.id
fetch(this.JobExecEndpoint)
.then(response => response.json())
.then(body => {
this.job_execs.push({
'code_checkouts': body[0].code_checkouts,
})
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>