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.

test_bot_data: Make test cases more accurate.

PieterCKe59c5ce655cd
diff --git a/web/tests/bot_data.test.cjs b/web/tests/bot_data.test.cjs
index 1a5ddbcda90..295e2cf2149 100644
--- a/web/tests/bot_data.test.cjs
+++ b/web/tests/bot_data.test.cjs
@@ -77,6 +77,7 @@ test("test_basics", () => {
const test_bot = {
api_key: "qwertyuioop1234567890",
avatar_url: "",
+ // Default bot
bot_type: 1,
default_all_public_streams: true,
default_events_register_stream: "register stream 43",
@@ -86,13 +87,7 @@ test("test_basics", () => {
is_active: true,
owner_id: 6,
user_id: 43,
- services: [
- {
- base_url: "http://bar.com",
- interface: 1,
- token: "some Bot 1 token",
- },
- ],
+ services: [],
extra: "This field should be ignored",
};
const test_embedded_bot = {
@@ -119,7 +114,6 @@ test("test_basics", () => {
(function test_add() {
bot_data.add(test_bot);
const bot = bot_data.get(43);
- const services = bot_data.get_services(43);
assert.equal("qwertyuioop1234567890", bot.api_key);
assert.equal("", bot.avatar_url);
assert.equal(1, bot.bot_type);
@@ -131,9 +125,6 @@ test("test_basics", () => {
assert.equal(true, bot.is_active);
assert.equal(6, bot.owner_id);
assert.equal(43, bot.user_id);
- assert.equal("http://bar.com", services[0].base_url);
- assert.equal(1, services[0].interface);
- assert.equal("some Bot 1 token", services[0].token);
assert.equal(undefined, bot.extra);
})();
@@ -145,14 +136,9 @@ test("test_basics", () => {
bot_data.update(43, {
...test_bot,
full_name: "New Bot 1",
- services: [{interface: 2, base_url: "http://baz.com", token: "zxcvbnm1234567890"}],
});
bot = bot_data.get(43);
- const services = bot_data.get_services(43);
assert.equal("New Bot 1", bot.full_name);
- assert.equal(2, services[0].interface);
- assert.equal("http://baz.com", services[0].base_url);
- assert.equal("zxcvbnm1234567890", services[0].token);
const change_owner_event = {
owner_id: fred.user_id,