Skip to content

A platform for community discussion. Free, open, simple.

DEV: Type the recorded responses in test fixtures (#44658)

Sérgio Saquetimfc39e9bbaf68
diff --git a/frontend/discourse/tests/fixtures/admin-search-fixtures.js b/frontend/discourse/tests/fixtures/admin-search-fixtures.js
index 302a1f2af55..92c8f453e0b 100644
--- a/frontend/discourse/tests/fixtures/admin-search-fixtures.js
+++ b/frontend/discourse/tests/fixtures/admin-search-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const adminSearchFixtures = {
"/admin/search/all.json": {
settings: [
diff --git a/frontend/discourse/tests/fixtures/badges-fixture.js b/frontend/discourse/tests/fixtures/badges-fixture.js
index c8c2fceb0a7..1298150a9fb 100644
--- a/frontend/discourse/tests/fixtures/badges-fixture.js
+++ b/frontend/discourse/tests/fixtures/badges-fixture.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const badgesFixtures = {
"/badges.json": {
badge_types: [
diff --git a/frontend/discourse/tests/fixtures/category-fixtures.js b/frontend/discourse/tests/fixtures/category-fixtures.js
index 66ea1d2509a..97cc9e3081f 100644
--- a/frontend/discourse/tests/fixtures/category-fixtures.js
+++ b/frontend/discourse/tests/fixtures/category-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const categoryFixtures = {
"/c/1/show.json": {
category: {
diff --git a/frontend/discourse/tests/fixtures/chat.js b/frontend/discourse/tests/fixtures/chat.js
index 958e3d2351a..0f56635f164 100644
--- a/frontend/discourse/tests/fixtures/chat.js
+++ b/frontend/discourse/tests/fixtures/chat.js
@@ -1,8 +1,9 @@
-export default {
+/** Recorded server responses, keyed by request URL. */
+export default /** @type {Record<string, Record<string, unknown>>} */ ({
"/chat/api/me/channels": {
public_channels: [],
direct_message_channels: [],
meta: { message_bus_last_ids: {} },
tracking: {},
},
-};
+});
diff --git a/frontend/discourse/tests/fixtures/dashboard-general.js b/frontend/discourse/tests/fixtures/dashboard-general.js
index 9685bc862bf..0ff4294af59 100644
--- a/frontend/discourse/tests/fixtures/dashboard-general.js
+++ b/frontend/discourse/tests/fixtures/dashboard-general.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const dashboardGeneralFixtures = {
"/admin/dashboard/general.json": {
reports: [],
diff --git a/frontend/discourse/tests/fixtures/dashboard-whats-new.js b/frontend/discourse/tests/fixtures/dashboard-whats-new.js
index 1e03fafd611..6a1ca839bfa 100644
--- a/frontend/discourse/tests/fixtures/dashboard-whats-new.js
+++ b/frontend/discourse/tests/fixtures/dashboard-whats-new.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const dashboardWhatsNewFixtures = {
"/admin/whats-new.json": {
new_features: [
diff --git a/frontend/discourse/tests/fixtures/directory-fixtures.js b/frontend/discourse/tests/fixtures/directory-fixtures.js
index 0cc1e9686dc..fb0af8b0807 100644
--- a/frontend/discourse/tests/fixtures/directory-fixtures.js
+++ b/frontend/discourse/tests/fixtures/directory-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const directoryFixtures = {
directory_items: {
directory_items: [
diff --git a/frontend/discourse/tests/fixtures/discovery-fixtures.js b/frontend/discourse/tests/fixtures/discovery-fixtures.js
index cd3e2333adf..acce3aff115 100644
--- a/frontend/discourse/tests/fixtures/discovery-fixtures.js
+++ b/frontend/discourse/tests/fixtures/discovery-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const discoveryFixtures = {
"/latest.json": {
users: [
diff --git a/frontend/discourse/tests/fixtures/drafts.js b/frontend/discourse/tests/fixtures/drafts.js
index 9c0976df405..e706690c414 100644
--- a/frontend/discourse/tests/fixtures/drafts.js
+++ b/frontend/discourse/tests/fixtures/drafts.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const draftsFixtures = {
"/drafts.json": {
drafts: [
diff --git a/frontend/discourse/tests/fixtures/group-fixtures.js b/frontend/discourse/tests/fixtures/group-fixtures.js
index 5fb438289c6..3520a00a826 100644
--- a/frontend/discourse/tests/fixtures/group-fixtures.js
+++ b/frontend/discourse/tests/fixtures/group-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const groupFixtures = {
"/groups/moderators.json": {
group: {
diff --git a/frontend/discourse/tests/fixtures/groups-fixtures.js b/frontend/discourse/tests/fixtures/groups-fixtures.js
index 8c6139b5969..ca54700bf14 100644
--- a/frontend/discourse/tests/fixtures/groups-fixtures.js
+++ b/frontend/discourse/tests/fixtures/groups-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const groupsFixtures = {
"/groups.json": {
groups: [
diff --git a/frontend/discourse/tests/fixtures/notification-fixtures.js b/frontend/discourse/tests/fixtures/notification-fixtures.js
index a7d6efc1884..86732a0114a 100644
--- a/frontend/discourse/tests/fixtures/notification-fixtures.js
+++ b/frontend/discourse/tests/fixtures/notification-fixtures.js
@@ -1,5 +1,10 @@
import { NOTIFICATION_TYPES } from "./concerns/notification-types.js";
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const notificationFixtures = {
"/notifications": {
notifications: [
diff --git a/frontend/discourse/tests/fixtures/pending-posts.js b/frontend/discourse/tests/fixtures/pending-posts.js
index f1ff9b123f1..5959bb29d5a 100644
--- a/frontend/discourse/tests/fixtures/pending-posts.js
+++ b/frontend/discourse/tests/fixtures/pending-posts.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const pendingPostsFixtures = {
"/posts/eviltrout/pending.json": {
pending_posts: [
diff --git a/frontend/discourse/tests/fixtures/poll.js b/frontend/discourse/tests/fixtures/poll.js
index c9e8a0357d8..c001473520b 100644
--- a/frontend/discourse/tests/fixtures/poll.js
+++ b/frontend/discourse/tests/fixtures/poll.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const pollFixtures = {
"/t/13.json": {
post_stream: {
diff --git a/frontend/discourse/tests/fixtures/post.js b/frontend/discourse/tests/fixtures/post.js
index eb84f679468..d15995fc0eb 100644
--- a/frontend/discourse/tests/fixtures/post.js
+++ b/frontend/discourse/tests/fixtures/post.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const postFixtures = {
"/posts/98737532": {
id: 98737532,
diff --git a/frontend/discourse/tests/fixtures/private-messages-fixtures.js b/frontend/discourse/tests/fixtures/private-messages-fixtures.js
index 5e75252e2bc..f835031d621 100644
--- a/frontend/discourse/tests/fixtures/private-messages-fixtures.js
+++ b/frontend/discourse/tests/fixtures/private-messages-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const privateMessagesFixtures = {
"/topics/private-messages/eviltrout.json": {
users: [
diff --git a/frontend/discourse/tests/fixtures/search-fixtures.js b/frontend/discourse/tests/fixtures/search-fixtures.js
index 7544d34079f..30b0ed1c4e7 100644
--- a/frontend/discourse/tests/fixtures/search-fixtures.js
+++ b/frontend/discourse/tests/fixtures/search-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const searchFixtures = {
"/search.json": {
posts: [
diff --git a/frontend/discourse/tests/fixtures/site-fixtures.js b/frontend/discourse/tests/fixtures/site-fixtures.js
index c1f576769b4..56ee38c813f 100644
--- a/frontend/discourse/tests/fixtures/site-fixtures.js
+++ b/frontend/discourse/tests/fixtures/site-fixtures.js
@@ -1,5 +1,10 @@
import { NOTIFICATION_TYPES } from "./concerns/notification-types.js";
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const siteFixtures = {
"site.json": {
site: {
diff --git a/frontend/discourse/tests/fixtures/site-settings.js b/frontend/discourse/tests/fixtures/site-settings.js
index 8616e276f22..17d7f1e2cfd 100644
--- a/frontend/discourse/tests/fixtures/site-settings.js
+++ b/frontend/discourse/tests/fixtures/site-settings.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const siteSettingsFixtures = {
"/admin/site_settings": {
site_settings: [
diff --git a/frontend/discourse/tests/fixtures/top-fixtures.js b/frontend/discourse/tests/fixtures/top-fixtures.js
index 965ad7040bb..958ff9a3d20 100644
--- a/frontend/discourse/tests/fixtures/top-fixtures.js
+++ b/frontend/discourse/tests/fixtures/top-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const topFixtures = {
"/top.json": {
users: [
diff --git a/frontend/discourse/tests/fixtures/topic.js b/frontend/discourse/tests/fixtures/topic.js
index c9088b52e83..490aae02e4d 100644
--- a/frontend/discourse/tests/fixtures/topic.js
+++ b/frontend/discourse/tests/fixtures/topic.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const topicFixtures = {
"/t/130.json": {
post_stream: {
diff --git a/frontend/discourse/tests/fixtures/user-badges.js b/frontend/discourse/tests/fixtures/user-badges.js
index d93aefd20bb..4b251c48b61 100644
--- a/frontend/discourse/tests/fixtures/user-badges.js
+++ b/frontend/discourse/tests/fixtures/user-badges.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const userBadgesFixtures = {
"/user_badges": {
badges: [
diff --git a/frontend/discourse/tests/fixtures/user-fixtures.js b/frontend/discourse/tests/fixtures/user-fixtures.js
index 615b722afa9..05e71749d66 100644
--- a/frontend/discourse/tests/fixtures/user-fixtures.js
+++ b/frontend/discourse/tests/fixtures/user-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const userFixtures = {
"/u/eviltrout.json": {
user_badges: [
diff --git a/frontend/discourse/tests/fixtures/user-menu.js b/frontend/discourse/tests/fixtures/user-menu.js
index 36f823e9325..c10e5c786ad 100644
--- a/frontend/discourse/tests/fixtures/user-menu.js
+++ b/frontend/discourse/tests/fixtures/user-menu.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const userMenuFixtures = {
"/u/:username/user-menu-bookmarks": {
notifications: [
diff --git a/frontend/discourse/tests/fixtures/watched-words-fixtures.js b/frontend/discourse/tests/fixtures/watched-words-fixtures.js
index e07a9ebdcf4..7c26ee650ec 100644
--- a/frontend/discourse/tests/fixtures/watched-words-fixtures.js
+++ b/frontend/discourse/tests/fixtures/watched-words-fixtures.js
@@ -1,3 +1,8 @@
+/**
+ * Recorded server responses, keyed by request URL.
+ *
+ * @type {Record<string, Record<string, unknown>>}
+ */
const watchedWordsFixtures = {
"/admin/customize/watched_words.json": {
actions: ["block", "censor", "require_approval", "flag", "replace", "tag"],