mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
zblueslip: Log output for all function calls.
Also adds asserts on blueslip.log() call in node_tests/people_errors.js.
This commit is contained in:
committed by
Tim Abbott
parent
47d53107a1
commit
bddb6a1a14
@@ -26,7 +26,8 @@ people.initialize_current_user(me.user_id);
|
|||||||
|
|
||||||
reload.is_in_progress = true;
|
reload.is_in_progress = true;
|
||||||
people.report_late_add(55, 'foo@example.com');
|
people.report_late_add(55, 'foo@example.com');
|
||||||
// TODO: Make zblueslip support logging things written to .log and assert result
|
assert.equal(blueslip.get_test_logs('log').length, 1);
|
||||||
|
assert.equal(blueslip.get_test_logs('log')[0], 'Added user late: user_id=55 email=foo@example.com');
|
||||||
assert.equal(blueslip.get_test_logs('error').length, 0);
|
assert.equal(blueslip.get_test_logs('error').length, 0);
|
||||||
blueslip.clear_test_data();
|
blueslip.clear_test_data();
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
var noop = function () {};
|
|
||||||
|
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
exports.make_zblueslip = function (opts) {
|
exports.make_zblueslip = function (opts) {
|
||||||
@@ -61,7 +59,10 @@ exports.make_zblueslip = function (opts) {
|
|||||||
// Create logging functions
|
// Create logging functions
|
||||||
Object.keys(opts).forEach(name => {
|
Object.keys(opts).forEach(name => {
|
||||||
if (!opts[name]) {
|
if (!opts[name]) {
|
||||||
lib[name] = noop;
|
// should just log the message.
|
||||||
|
lib[name] = function (message) {
|
||||||
|
lib.test_logs[name].push(message);
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lib[name] = function (message) {
|
lib[name] = function (message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user