mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
Add run_test helper for individual tests.
This run_test helper sets up a convention that allows us to give really short tracebacks for errors, and eventually we can have more control over running individual tests. (The latter goal has some complications, since we often intentionally leak setup in tests.)
This commit is contained in:
@@ -40,7 +40,7 @@ function test_with_mock_socket(test_params) {
|
||||
test_params.check_send_args(send_args);
|
||||
}
|
||||
|
||||
(function test_transmit_message_sockets() {
|
||||
run_test('transmit_message_sockets', () => {
|
||||
page_params.use_websockets = true;
|
||||
global.navigator.userAgent = 'unittest_transmit_message';
|
||||
|
||||
@@ -86,11 +86,11 @@ function test_with_mock_socket(test_params) {
|
||||
assert(error_func_checked);
|
||||
},
|
||||
});
|
||||
}());
|
||||
});
|
||||
|
||||
page_params.use_websockets = false;
|
||||
|
||||
(function test_transmit_message_ajax() {
|
||||
run_test('transmit_message_ajax', () => {
|
||||
|
||||
var success_func_called;
|
||||
var success = function () {
|
||||
@@ -128,9 +128,9 @@ page_params.use_websockets = false;
|
||||
};
|
||||
transmit.send_message(request, success, error);
|
||||
assert(error_func_called);
|
||||
}());
|
||||
});
|
||||
|
||||
(function test_transmit_message_ajax_reload_pending() {
|
||||
run_test('transmit_message_ajax_reload_pending', () => {
|
||||
var success = function () { throw 'unexpected success'; };
|
||||
|
||||
reload.is_pending = function () {
|
||||
@@ -167,4 +167,4 @@ page_params.use_websockets = false;
|
||||
transmit.send_message(request, success, error);
|
||||
assert(!error_func_called);
|
||||
assert(reload_initiated);
|
||||
}());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user