Skip to content

Commit

Permalink
add test for multipart upload empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffbski committed Mar 15, 2013
1 parent 5da25ef commit 3d8eb8d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/_files/empty
@@ -0,0 +1,7 @@
--AaB03x
Content-Type: text/plain
Content-Disposition: attachment; name="files"; filename=empty.txt; modification-date="Wed, 12 Feb 1997 16:29:51 -0500";
Content-Description: an empty text file


--AaB03x--
28 changes: 28 additions & 0 deletions test/multipart-test.js
Expand Up @@ -124,6 +124,34 @@ describe('multipart', function () {
});
});

describe('for an empty text file upload', function () {
parseFixture('empty');

it('correctly parses the file name', function () {
var file = params.files;
assert.ok(file);
assert.equal(file.name, 'empty.txt');
});

it('correctly parses the file content type', function () {
var file = params.files;
assert.ok(file);
assert.equal(file.type, 'text/plain');
});

it('correctly determines the file size', function () {
var file = params.files;
assert.ok(file);
assert.strictEqual(file.size, 0);
});

it("correctly parses the file's contents", function () {
var file = params.files;
assert.ok(file);
assert.equal(fs.readFileSync(file.path, 'utf8'), '');
});
});

describe('for a text file upload using IE-style filename', function () {
parseFixture('text_ie');

Expand Down

0 comments on commit 3d8eb8d

Please sign in to comment.