|
| 1 | +/* eslint-env node, mocha */ |
1 | 2 | 'use strict'; |
| 3 | + |
2 | 4 | const assert = require('assert'); |
3 | 5 | const should = require('should'); |
4 | 6 | const File = require('../lib/models/File'); |
5 | | -const Uid = require('../lib/models/Uid'); |
6 | 7 |
|
7 | 8 | describe('File', () => { |
8 | | - it('should have an ID', (done) => { |
9 | | - const file = new File(1); |
10 | | - file.should.have.property('id'); |
11 | | - assert.equal(typeof file.id, 'string'); |
12 | | - done(); |
| 9 | + |
| 10 | + describe('constructor', () => { |
| 11 | + it('must be given either a upload_length or upload_defer_length', (done) => { |
| 12 | + assert.throws(() => { new File(); }, Error); |
| 13 | + done(); |
| 14 | + }); |
| 15 | + |
| 16 | + it('should generate an the ID for the file', (done) => { |
| 17 | + const file = new File(1); |
| 18 | + file.should.have.property('id'); |
| 19 | + assert.equal(typeof file.id, 'string'); |
| 20 | + done(); |
| 21 | + }); |
| 22 | + |
| 23 | + it('should set properties given', (done) => { |
| 24 | + const upload_length = 1234; |
| 25 | + const upload_defer_length = 1; |
| 26 | + const upload_metadata = 'metadata'; |
| 27 | + const file = new File(upload_length, upload_defer_length, upload_metadata); |
| 28 | + assert.equal(file.upload_length, upload_length); |
| 29 | + assert.equal(file.upload_defer_length, upload_defer_length); |
| 30 | + assert.equal(file.upload_metadata, upload_metadata); |
| 31 | + done(); |
| 32 | + }); |
13 | 33 | }); |
14 | 34 | }); |
0 commit comments