how "component.QRcode" will be defined in the spec.test file

Viewed 49

.ts file

generateQRCode(data){
     let reader = new FileReader();
     reader.readAsDataURL(data);
     reader.onload = ()=>{
       this.QRcode = reader.result;
     }
   }

.spec.ts file

it('generateQRCode',()=>{
     const fakeFile = new File([new Blob(['123'])], 'abc.gif',{type:'image/gif'})
     component.generateQRCode(fakeFile)
     **expect(component.QRcode).toBeDefined();**
   })

how to "component.QRcode" will be defined in the test file

0 Answers
Related