You need to sign in to do that
Don't have an account?
sksfdc221
Test Class for LWC Component
I have a LWC Component which is used for record upload process.
Below is my LWC Javascript code:
.
Being new to JS, I am in process of exploring Jest Test Classes. Can anyone please help me out with the test class to cover my above given component?
Below is my LWC Javascript code:
import { LightningElement, api } from 'lwc'; import file1 from '@salesforce/apex/customLwcController.file1'; import file2 from '@salesforce/apex/customLwcController.file2'; export default class customRecordProcess extends LightningElement { @api customRecordId; fileName = null; customFileId = null; showModalButton = false; modalButtonLabel = ''; showFileName = false; customFileIds = []; isModalOpen = false; onUploadComplete(file, result) { console.log('onUploadComplete'); this.customFileIds.push({Id: result, Title: file.name}); if (this.fileName === null) { this.fileName = file.name; this.customFileId = result; } this.updateDisplayText(); } handleFileUpload(event){ let file = event.target.files[0]; let reader = new customReader(); file.sObject } }Below is my HTML Code:
<template> <div class="slds-grid"> <lightning-formatted-text class="left-col" value=""></lightning-formatted-text> <div class="middle-col"> <lightning-input class="inp middle-col" type="file" onchange={handleFileUpload}> </lightning-input> </div> </template>Now, I need to compile this component using Jest Test class before deploying the changes
.
Being new to JS, I am in process of exploring Jest Test Classes. Can anyone please help me out with the test class to cover my above given component?