Browse files

add test for multipart upload empty file

  • Loading branch information...
1 parent 5da25ef commit 3d8eb8d3f8efd65bf039b583858573dc2516ac3b @jeffbski jeffbski committed Mar 15, 2013
Showing with 35 additions and 0 deletions.
  1. +7 −0 test/_files/empty
  2. +28 −0 test/multipart-test.js
View
7 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--
View
28 test/multipart-test.js
@@ -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');

0 comments on commit 3d8eb8d

Please sign in to comment.