Skip to content
Permalink
8e338e1e6b
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
44 lines (35 sloc) 1.16 KB
'use strict'
const Uploads = require('../modules/upload.js')
describe('deleteRecord()', () => {
test('the deletd file does not still exist in db', async done => {
expect.assertions(1)
const todo = await new Uploads()
await expect(todo.deletedRecord('lab5')).toBeNull()
done()
})
})
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()
})
})