-
Notifications
You must be signed in to change notification settings - Fork 4
/
uploads_test.js
45 lines (40 loc) · 1.17 KB
/
uploads_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(function() {
var Upload, Uploads, should;
Uploads = require('../../lib/uploads');
Upload = require('../../lib/upload');
should = require('should');
describe('Uploads', function() {
var $;
$ = {};
beforeEach(function() {
$.uploads = new Uploads;
return $.upload = new Upload;
});
describe('add', function() {
it('should add without upload', function() {
var upload;
upload = $.uploads.add(1);
return should.exist(upload);
});
return it('should add and get a new upload', function() {
$.uploads.add(1, $.upload);
return $.uploads.get(1).should.equal($.upload);
});
});
describe('get', function() {
return it('should return nil if the upload does not exist', function() {
return should.not.exist($.uploads.get(1));
});
});
return describe('remove', function() {
return it('should remove an upload', function(done) {
$.uploads.add(1, $.upload);
$.uploads.remove(1, 10);
return setTimeout(function() {
should.not.exist($.uploads.get(1));
return done();
}, 10);
});
});
});
}).call(this);