Permalink
Browse files

Hax to get test suit working again.

  • Loading branch information...
1 parent 71977c1 commit a00d3e7db9325a52b85ee8f81b0cf96c0eb53938 @godsflaw godsflaw committed May 31, 2013
Showing with 35 additions and 19 deletions.
  1. +0 −6 docs/Transaction.md
  2. +3 −1 run_tests
  3. +17 −7 tests/smtp_client/auth.js
  4. +15 −5 tests/smtp_client/basic.js
View
@@ -53,12 +53,6 @@ The number of bytes in the email after DATA.
Adds a line of data to the email. Note this is RAW email - it isn't useful
for adding banners to the email.
-* transaction.add_line_end(cb)
-
-Notifies the message_stream that all the data has been received.
-Supply an optional callback function that will be run once any inflight data
-is finished being written.
-
* transaction.notes
A safe place to store transaction specific values.
View
@@ -17,4 +17,6 @@ catch(e) {
}
process.chdir(__dirname);
-reporter.run(['tests', 'tests/plugins']);
+reporter.run(['tests', 'tests/plugins'], undefined, function () {
+ process.exit();
+});
View
@@ -1,4 +1,6 @@
-test.expect(25);
+var MessageStream = require('./messagestream');
+
+test.expect(22);
var server = {notes: {}};
exports.get_pool(server);
@@ -13,6 +15,10 @@ exports.get_client(server, function(err, smtp_client) {
test.equals(1, server.notes.pool[pool_name].getPoolSize());
test.equals(0, server.notes.pool[pool_name].availableObjectsCount());
+ var message_stream = new MessageStream(
+ { main : { spool_after : 1024 } }, "123456789"
+ );
+
var data = [];
var reading_body = false;
data.push('220 hi');
@@ -56,14 +62,18 @@ exports.get_client(server, function(err, smtp_client) {
smtp_client.on('data', function () {
test.equals(smtp_client.response[0], 'go ahead');
- smtp_client.start_data(['Header: test\r\n', '\r\n', 'hi\r\n']);
+ smtp_client.start_data(message_stream);
+ message_stream.on('end', function () {
+ smtp_client.socket.write('.\r\n');
+ });
+ message_stream.add_line('Header: test\r\n');
+ message_stream.add_line('\r\n');
+ message_stream.add_line('hi\r\n');
+ message_stream.add_line_end();
});
- data.push('Header: test');
- data.push('');
- data.push('hi');
- data.push('.');
- data.push('250 message queued');
+ data.push('.');
+ data.push('250 message queued');
smtp_client.on('dot', function () {
test.equals(smtp_client.response[0], 'message queued');
View
@@ -1,4 +1,6 @@
-test.expect(24);
+var MessageStream = require('./messagestream');
+
+test.expect(21);
var server = {notes: {}};
exports.get_pool(server);
@@ -13,6 +15,10 @@ exports.get_client(server, function(err, smtp_client) {
test.equals(1, server.notes.pool[pool_name].getPoolSize());
test.equals(0, server.notes.pool[pool_name].availableObjectsCount());
+ var message_stream = new MessageStream(
+ { main : { spool_after : 1024 } }, "123456789"
+ );
+
var data = [];
var reading_body = false;
data.push('220 hi');
@@ -52,12 +58,16 @@ exports.get_client(server, function(err, smtp_client) {
smtp_client.on('data', function () {
test.equals(smtp_client.response[0], 'go ahead');
- smtp_client.start_data(['Header: test\r\n', '\r\n', 'hi\r\n']);
+ smtp_client.start_data(message_stream);
+ message_stream.on('end', function () {
+ smtp_client.socket.write('.\r\n');
+ });
+ message_stream.add_line('Header: test\r\n');
+ message_stream.add_line('\r\n');
+ message_stream.add_line('hi\r\n');
+ message_stream.add_line_end();
});
- data.push('Header: test');
- data.push('');
- data.push('hi');
data.push('.');
data.push('250 message queued');

0 comments on commit a00d3e7

Please sign in to comment.