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:
Steve Howell
2018-05-15 10:40:07 +00:00
committed by Tim Abbott
parent 4f0b3fc1b6
commit 42435db492
85 changed files with 815 additions and 807 deletions

View File

@@ -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);
}());
});