Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
File-Sharing-Website/unit tests/upload.spec.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (27 sloc)
955 Bytes
This file contains 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
'use strict' | |
const Uploads = require('../modules/upload.js') | |
describe('upload()', () => { | |
test('File Name missing', async done => { | |
expect.assertions(1) | |
const todo = await new Uploads() | |
await expect(todo.upload( | |
'png','',200,'Wed 20/20/19 15:20:20','path','Userpath')).rejects.toEqual(Error('String cannot be empty.')) | |
done() | |
}) | |
test('File Not bigger than a GB', async done => { | |
expect.assertions(1) | |
const todo = await new Uploads() | |
await expect(todo.upload( | |
'png','name',1073741824,'Wed 20/20/19 15:20:20', | |
'path','Userpath')).rejects.toEqual(Error('Size cannot be equal or greater than a GB')) | |
done() | |
}) | |
test('File Name string too long', async done => { | |
expect.assertions(1) | |
const todo = await new Uploads() | |
await expect(todo.upload( | |
'png','K8DbQxhva2qECr7urmCOVOayGnf6OUh2MCjYC9VaO04m9SXLui', | |
10750,'Wed 20/20/19 15:20:20','path','Userpath')).rejects.toEqual(Error('String size too big')) | |
done() | |
}) | |
}) |