Created
April 14, 2022 00:38
-
-
Save MCarlomagno/434564499b2a7ea3a4640d3005544155 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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