Permalink
Browse files

Merge pull request #1049 from ekashida/fix-functional

fix functional tests after refactor on tunnel
  • Loading branch information...
2 parents ba81d40 + ebf6a0c commit f416efa94c3e194e20458d62e1a7a0747990d1df @caridy caridy committed Mar 28, 2013
@@ -51,7 +51,10 @@ module.exports = function (config) {
new Error('Error opening: ' + req.url + '\n' + err)
);
}
- res.send(200, data);
+ res.writeHead(200, {
+ 'content-type': 'application/json'
+ });
+ res.end(JSON.stringify(data));
}
);
};
@@ -42,7 +42,10 @@ module.exports = function (config) {
new Error('Error opening: ' + req.url + '\n' + err)
);
}
- res.send(200, data);
+ res.writeHead(200, {
+ 'content-type': 'application/json'
+ });
+ res.end(JSON.stringify(data));
}
);
};
@@ -20,7 +20,6 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
req,
res,
sendData,
- statusCode,
nextCallCount,
middleware,
store,
@@ -54,9 +53,9 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
};
res = {
- send: function (code, data) {
- sendData = data;
- statusCode = code;
+ writeHead: function () {},
+ end: function (data) {
+ sendData = data;
}
};
},
@@ -66,7 +65,6 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
nextCallCount = 0;
sendData = undefined;
- statusCode = undefined;
store = null;
config = null;
req = null;
@@ -140,9 +138,8 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
});
A.areSame(0, nextCallCount, 'next() handler should not have been called');
- A.areSame(200, statusCode, 'status code should have been set to 200');
- A.isUndefined(error, 'next() handler should have received an error');
- A.areSame(data, sendData, 'data should have been sent');
+ A.isUndefined(error, 'next() handler should not have received an error');
+ A.areEqual(JSON.stringify(data), sendData, 'data should have been sent');
}
}));
});
@@ -20,7 +20,6 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
req,
res,
sendData,
- statusCode,
nextCallCount,
middleware,
store,
@@ -53,9 +52,9 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
};
res = {
- send: function (code, data) {
- sendData = data;
- statusCode = code;
+ writeHead: function () {},
+ end: function (data) {
+ sendData = data;
}
};
},
@@ -65,7 +64,6 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
nextCallCount = 0;
sendData = undefined;
- statusCode = undefined;
store = null;
config = null;
req = null;
@@ -126,9 +124,8 @@ YUI().use('mojito-test-extra', 'test', function (Y) {
});
A.areSame(0, nextCallCount, 'next() handler should not have been called');
- A.areSame(200, statusCode, 'status code should have been set to 200');
A.isUndefined(error, 'next() handler should have received an error');
- A.areSame(data, sendData, 'data should have been sent');
+ A.areEqual(JSON.stringify(data), sendData, 'data should have been sent');
}
}));
});

0 comments on commit f416efa

Please sign in to comment.