Skip to content

Commit

Permalink
feat: Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
crackdev01 committed Jun 29, 2023
1 parent 5e247d2 commit d6b9034
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cypress/component/CreateUpdateTaskForm.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import { mount } from "cypress-react-unit-test";
import CreateUpdateTaskForm from '../../src/components/universaldot/DAO/CreateUpdateTaskForm';

const taskFormData = {
title: '',
specification: '',
budget: '',
deadline: '',
attachments: '',
keywords: '',
};

describe("IPFS File Upload Testing", () => {
it("should handle file upload correctly", () => {

const mockFunction = cy.stub();
mount(<CreateUpdateTaskForm
taskForm={taskFormData || {}}
onCancel={mockFunction}
actionCb={mockFunction}
/>);

cy.get<HTMLInputElement>('input[type="file"]').attachFile('test.txt');

// Assert that the file input value is set correctly
cy.get('input[type="file"]').should('have.value', 'test.txt');

});
});

0 comments on commit d6b9034

Please sign in to comment.