Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
it("uploads a valid file", async () => {
// checks filecount variable
// before uploading the file
const countBeforeUpload = await this.contract.fileCount();
await this.contract.uploadFile('path', 1, 'type', 'name');
// checks filecount increased
// by one after upload
const countAfterUpload = await this.contract.fileCount();
assert.equal(Number(countAfterUpload), Number(countBeforeUpload) + 1, "count increased to 1 after upload")
// checks last file contains the same
// info than the uploaded file
const lastFile = await this.contract.files(countAfterUpload);
assert.equal(lastFile.fileName, 'name', "last file has the filename of the previous uploaded file")
assert.equal(lastFile.filePath, 'path', "last file has the path of the previous uploaded file")
assert.equal(lastFile.fileSize, 1, "last file has the size of the previous uploaded file")
assert.equal(lastFile.fileType, 'type', "last file has the type of the previous uploaded file")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment