mirror of https://github.com/zulip/zulip.git
server_events_dispatch: Throw from "subscription" based on event.op.
This commit is contained in:
parent
d89c405074
commit
bc69521caa
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
||||||
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||||
const {make_stub} = require("../zjsunit/stub");
|
const {make_stub} = require("../zjsunit/stub");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
const blueslip = require("../zjsunit/zblueslip");
|
||||||
const $ = require("../zjsunit/zjquery");
|
const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
@ -875,3 +876,8 @@ run_test("realm_export", (override) => {
|
||||||
const args = stub.get_args("exports");
|
const args = stub.get_args("exports");
|
||||||
assert.equal(args.exports, event.exports);
|
assert.equal(args.exports, event.exports);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
run_test("server_event_dispatch_op_errors", () => {
|
||||||
|
blueslip.expect("error", "Unexpected event type subscription/other");
|
||||||
|
server_events_dispatch.dispatch_normal_event({type: "subscription", op: "other"});
|
||||||
|
});
|
||||||
|
|
|
@ -471,6 +471,9 @@ export function dispatch_normal_event(event) {
|
||||||
case "update":
|
case "update":
|
||||||
stream_events.update_property(event.stream_id, event.property, event.value);
|
stream_events.update_property(event.stream_id, event.property, event.value);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
blueslip.error("Unexpected event type subscription/" + event.op);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "typing":
|
case "typing":
|
||||||
|
|
Loading…
Reference in New Issue