Closed restuwahyu13 closed 3 years ago
Solved my issue with this
tracker.on('query', (query, step) => {
return [
() => {
if (query.method !== undefined && step === 1) chai.expect(query.method).to.equal('first')
query.response(mockData.carProtection)
},
() => {
if (query.method !== undefined && step === 2) chai.expect(query.method).to.equal('first')
query.response(mockData.carProtection)
},
() => {
if (query.method !== undefined && step === 3) chai.expect(query.method).to.equal('insert')
query.response([mockData.carProtection])
}
][step - 1]()
})
Step not working with multiple same method, my problem is, if I give value to step 2 with undefined, I get response back
company id is not exist
and I give value to step 2 with object I get response backCar protection name already exist
, it should be if I give value to step 1 with object and I give value to step two with undefined, It will go to next step to 3, but this goes back to the first step and I get response backcompany id is not exist
, how to fix it this issue ?My Controller
My Test