Permalink
Browse files

Test cases for substack's patches

  • Loading branch information...
1 parent 6e5c78b commit 8f5e7f4587f1108b1c86e0cbd15ce308b777c2ff @felixge committed Sep 8, 2010
Showing with 15 additions and 2 deletions.
  1. +15 −2 test/simple/test-incoming-form.js
@@ -4,7 +4,8 @@ var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser')
, EventEmitterStub = GENTLY.stub('events', 'EventEmitter')
, WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
-var IncomingForm = require('formidable/incoming_form').IncomingForm
+var formidable = require('formidable')
+ , IncomingForm = formidable.IncomingForm
, events = require('events')
, fs = require('fs')
, path = require('path')
@@ -37,6 +38,18 @@ test(function constructor() {
assert.strictEqual(form._fieldsSize, 0);
assert.ok(form instanceof EventEmitterStub);
assert.equal(form.constructor.name, 'IncomingForm');
+
+ (function testSimpleConstructor() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = IncomingForm();
+ assert.ok(form instanceof IncomingForm);
+ })();
+
+ (function testSimpleConstructorShortcut() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = formidable();
+ assert.ok(form instanceof IncomingForm);
+ })();
});
test(function parse() {
@@ -673,4 +686,4 @@ test(function _maybeEnd() {
form.ended = true;
form._flushing = 0;
form._maybeEnd();
-});
+});

0 comments on commit 8f5e7f4

Please sign in to comment.