dimanche 26 août 2018

File upload in a dropzone Enzyme Mocha

How can I test file upload in a dropzone with enzyme and Mocha. In this case I just want to check that state accepted length is bigger than 0 if a file is uploaded but I am not sure how can I mock a file. I am using react-dropzone.

<Dropzone className="dropZoneBox"
            onDrop={this.state.accepted.length === 0 ? (accepted) => { this.setState({ accepted }); } : null}
            style=""
          >
            <p>-</p>
            <p>Only-</p>
          </Dropzone>

Aucun commentaire:

Enregistrer un commentaire