Code coverage for link/unlink endpoints

This commit is contained in:
Cadence Ember 2025-02-07 16:45:47 +13:00
parent a29d019d17
commit a90d3b9055
13 changed files with 802 additions and 67 deletions

View file

@ -43,7 +43,7 @@ module.exports = {
rate_limit_per_user: 0,
position: 0,
permission_overwrites: [],
parent_id: "665289423482519566",
parent_id: null,
name: "saving-the-world",
last_pin_timestamp: "2021-04-14T18:39:41+00:00",
last_message_id: "1335828749479837750",
@ -58,7 +58,7 @@ module.exports = {
"m.room.topic/": {topic: "#collective-unconscious | https://docs.google.com/document/d/blah/edit | I spread, pipe, and whip because it is my will. :headstone:\n\nChannel ID: 112760669178241024\nGuild ID: 112760669178241024"},
"m.room.guest_access/": {guest_access: "can_join"},
"m.room.history_visibility/": {history_visibility: "shared"},
"m.space.parent/!jjWAGMeQdNrVZSSfvz:cadence.moe": {
"m.space.parent/!jjmvBegULiLucuWEHU:cadence.moe": {
via: ["cadence.moe"],
canonical: true
},
@ -66,7 +66,7 @@ module.exports = {
join_rule: "restricted",
allow: [{
type: "m.room_membership",
room_id: "!jjWAGMeQdNrVZSSfvz:cadence.moe"
room_id: "!jjmvBegULiLucuWEHU:cadence.moe"
}]
},
"m.room.avatar/": {

View file

@ -6,7 +6,7 @@ INSERT INTO guild_active (guild_id, autocreate) VALUES
('665289423482519565', 0);
INSERT INTO guild_space (guild_id, space_id, privacy_level) VALUES
('112760669178241024', '!jjWAGMeQdNrVZSSfvz:cadence.moe', 0);
('112760669178241024', '!jjmvBegULiLucuWEHU:cadence.moe', 0);
INSERT INTO channel_room (channel_id, room_id, name, nick, thread_parent, custom_avatar) VALUES
('112760669178241024', '!kLRqKKUQXcibIMtOpl:cadence.moe', 'heave', 'main', NULL, NULL),
@ -176,6 +176,7 @@ INSERT INTO media_proxy (permitted_hash) VALUES
INSERT INTO invite (mxid, room_id, type, name, avatar, topic) VALUES
('@cadence:cadence.moe', '!zTMspHVUBhFLLSdmnS:cadence.moe', 'm.space', 'Data Horde', 'mxc://cadence.moe/TLqQOsTSrZkVKwBSWYTZNTrw', 'here is the space topic'),
('@cadence:cadence.moe', '!jjmvBegULiLucuWEHU:cadence.moe', 'm.space', 'Epicord', NULL, NULL),
('@cadence:cadence.moe', '!room:cadence.moe', NULL, 'some room', NULL, NULL),
('@rnl:cadence.moe', '!space:cadence.moe', NULL, 'somebody else''s space', NULL, NULL);

View file

@ -157,4 +157,5 @@ file._actuallyUploadDiscordFileToMxc = function(url, res) { throw new Error(`Not
require("../src/web/routes/download-discord.test")
require("../src/web/routes/download-matrix.test")
require("../src/web/routes/guild.test")
require("../src/web/routes/link.test")
})()

View file

@ -47,7 +47,7 @@ class Router {
/**
* @param {string} method
* @param {string} inputUrl
* @param {{event?: any, params?: any, body?: any, sessionData?: any, api?: Partial<import("../src/matrix/api")>, snow?: {[k in keyof SnowTransfer]?: Partial<SnowTransfer[k]>}, headers?: any}} [options]
* @param {{event?: any, params?: any, body?: any, sessionData?: any, api?: Partial<import("../src/matrix/api")>, snow?: {[k in keyof SnowTransfer]?: Partial<SnowTransfer[k]>}, createRoom?: Partial<import("../src/d2m/actions/create-room")>, createSpace?: Partial<import("../src/d2m/actions/create-space")>, headers?: any}} [options]
*/
test(method, inputUrl, options = {}) {
const url = new URL(inputUrl, "http://a")
@ -79,6 +79,8 @@ class Router {
api: options.api,
params: options.params,
snow: options.snow,
createRoom: options.createRoom,
createSpace: options.createSpace,
sessions: {
h3: {
id: "h3",