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.

eslint: Fix unicorn/consistent-assert.

Anders Kaseorga309bbe121f3
diff --git a/web/e2e-tests/compose.test.ts b/web/e2e-tests/compose.test.ts
index 13335f405e5..0f22ae6dd99 100644
--- a/web/e2e-tests/compose.test.ts
+++ b/web/e2e-tests/compose.test.ts
@@ -85,7 +85,7 @@ async function test_reply_by_click_prepopulates_private_message_recipient(
await private_message.click();
await page.waitForSelector("#private_message_recipient", {visible: true});
const email = await common.get_internal_email_from_name(page, common.fullname.cordelia);
- assert(email !== undefined);
+ assert.ok(email !== undefined);
await common.pm_recipient.expect(page, email);
await close_compose_box(page);
}
diff --git a/web/e2e-tests/lib/common.ts b/web/e2e-tests/lib/common.ts
index 5bc2bb4b79f..724755b5d41 100644
--- a/web/e2e-tests/lib/common.ts
+++ b/web/e2e-tests/lib/common.ts
@@ -318,7 +318,7 @@ export async function assert_compose_box_content(
expected_value: string,
): Promise<void> {
const compose_box_element = await page.waitForSelector("textarea#compose-textarea");
- assert(compose_box_element !== null);
+ assert.ok(compose_box_element !== null);
const compose_box_content = await page.evaluate(
(element) => element.value,
compose_box_element,
@@ -408,7 +408,7 @@ export async function select_stream_in_compose_via_dropdown(
const stream_to_select = `.dropdown-list-container .list-item[data-name="${stream_name}"]`;
await page.waitForSelector(stream_to_select, {visible: true});
await page.click(stream_to_select);
- assert((await page.$(".dropdown-list-container")) === null);
+ assert.ok((await page.$(".dropdown-list-container")) === null);
}
// Wait for any previous send to finish, then send a message.
@@ -757,6 +757,6 @@ export async function get_current_msg_list_id(
);
}
last_current_msg_list_id = await page.evaluate(() => zulip_test.current_msg_list?.id);
- assert(last_current_msg_list_id !== undefined);
+ assert.ok(last_current_msg_list_id !== undefined);
return last_current_msg_list_id;
}
diff --git a/web/e2e-tests/message-basics.test.ts b/web/e2e-tests/message-basics.test.ts
index b72d12c103a..0d43942b8f1 100644
--- a/web/e2e-tests/message-basics.test.ts
+++ b/web/e2e-tests/message-basics.test.ts
@@ -6,7 +6,7 @@ import * as common from "./lib/common.ts";
async function get_stream_li(page: Page, stream_name: string): Promise<string> {
const stream_id = await common.get_stream_id(page, stream_name);
- assert(stream_id !== undefined);
+ assert.ok(stream_id !== undefined);
return `#stream_filters [data-stream-id="${CSS.escape(stream_id.toString())}"]`;
}
diff --git a/web/e2e-tests/navigation.test.ts b/web/e2e-tests/navigation.test.ts
index bc94dfa97e7..6252de25835 100644
--- a/web/e2e-tests/navigation.test.ts
+++ b/web/e2e-tests/navigation.test.ts
@@ -66,7 +66,7 @@ async function navigate_to_private_messages(page: Page): Promise<void> {
async function test_reload_hash(page: Page): Promise<void> {
const initial_page_load_time = await page.evaluate(() => zulip_test.page_load_time);
- assert(initial_page_load_time !== undefined);
+ assert.ok(initial_page_load_time !== undefined);
console.log(`initial load time: ${initial_page_load_time}`);
const initial_hash = await page.evaluate(() => window.location.hash);
@@ -81,7 +81,7 @@ async function test_reload_hash(page: Page): Promise<void> {
});
const page_load_time = await page.evaluate(() => zulip_test.page_load_time);
- assert(page_load_time !== undefined);
+ assert.ok(page_load_time !== undefined);
assert.ok(page_load_time > initial_page_load_time, "Page not reloaded.");
const hash = await page.evaluate(() => window.location.hash);
diff --git a/web/e2e-tests/realm-creation.test.ts b/web/e2e-tests/realm-creation.test.ts
index 42d9cc8711a..0b87dd1474b 100644
--- a/web/e2e-tests/realm-creation.test.ts
+++ b/web/e2e-tests/realm-creation.test.ts
@@ -36,7 +36,7 @@ async function realm_creation_tests(page: Page): Promise<void> {
// Open the confirmation URL
const page_content = await page.evaluate(() => document.querySelector("body")!.textContent);
- assert(page_content !== null);
+ assert.ok(page_content !== null);
const {confirmation_key} = z
.object({confirmation_key: z.string()})
.parse(JSON.parse(page_content));
diff --git a/web/e2e-tests/stream_create.test.ts b/web/e2e-tests/stream_create.test.ts
index 790bc98b472..c426ed5a4b5 100644
--- a/web/e2e-tests/stream_create.test.ts
+++ b/web/e2e-tests/stream_create.test.ts
@@ -22,7 +22,7 @@ async function await_user_hidden(page: Page, name: string): Promise<void> {
async function add_user_to_stream(page: Page, name: string): Promise<void> {
const user_id = await common.get_user_id_from_name(page, name);
- assert(user_id !== undefined);
+ assert.ok(user_id !== undefined);
await page.evaluate((user_id) => {
zulip_test.add_user_id_to_new_stream(user_id);
}, user_id);
diff --git a/web/e2e-tests/user-deactivation.test.ts b/web/e2e-tests/user-deactivation.test.ts
index 1199f4fd562..8d28e403dad 100644
--- a/web/e2e-tests/user-deactivation.test.ts
+++ b/web/e2e-tests/user-deactivation.test.ts
@@ -20,7 +20,7 @@ async function navigate_to_user_list(page: Page): Promise<void> {
async function user_row(page: Page, name: string): Promise<string> {
const user_id = await common.get_user_id_from_name(page, name);
- assert(user_id !== undefined);
+ assert.ok(user_id !== undefined);
return `.user_row[data-user-id="${CSS.escape(user_id.toString())}"]`;
}