Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

util: Add test coverage for lower_same.

evykassirer34b6be668e8f
diff --git a/web/tests/util.test.js b/web/tests/util.test.js
index 128cf65af65..3781002211f 100644
--- a/web/tests/util.test.js
+++ b/web/tests/util.test.js
@@ -7,6 +7,8 @@ const _ = require("lodash");
const {set_global, zrequire} = require("./lib/namespace");
const {run_test} = require("./lib/test");
+const blueslip = zrequire("blueslip");
+
set_global("document", {});
const util = zrequire("util");
@@ -46,6 +48,14 @@ run_test("lower_bound", () => {
assert.equal(util.lower_bound(arr, 55, compare), 5);
});
+run_test("lower_same", () => {
+ assert.ok(util.lower_same("abc", "AbC"));
+ assert.ok(!util.lower_same("abbc", "AbC"));
+
+ blueslip.expect("error", "Cannot compare strings; at least one value is undefined");
+ util.lower_same("abc", undefined);
+});
+
run_test("same_recipient", () => {
assert.ok(
util.same_recipient(