',
];
}
if (request.queryParams.url.indexOf("/internal-page.html") > -1) {
return [
200,
{ "Content-Type": "application/html" },
'',
];
}
if (request.queryParams.url === "http://somegoodurl.com/") {
return [
200,
{ "Content-Type": "application/html" },
`
`,
];
}
if (
request.queryParams.url ===
"https://twitter.com/discourse/status/1357664660724482048"
) {
return [
200,
{ "Content-Type": "application/html" },
`
`,
];
}
return [404, { "Content-Type": "application/html" }, ""];
});
pretender.get("edit-directory-columns.json", () => {
return response(200, {
directory_columns: [
{
id: 1,
name: "likes_received",
type: "automatic",
enabled: true,
automatic_position: 1,
position: 1,
icon: "heart",
user_field: null,
},
{
id: 2,
name: "likes_given",
type: "automatic",
enabled: true,
automatic_position: 2,
position: 2,
icon: "heart",
user_field: null,
},
{
id: 3,
name: "topic_count",
type: "automatic",
enabled: true,
automatic_position: 3,
position: 3,
icon: null,
user_field: null,
},
{
id: 4,
name: "post_count",
type: "automatic",
enabled: true,
automatic_position: 4,
position: 4,
icon: null,
user_field: null,
},
{
id: 5,
name: "topics_entered",
type: "automatic",
enabled: true,
automatic_position: 5,
position: 5,
icon: null,
user_field: null,
},
{
id: 6,
name: "posts_read",
type: "automatic",
enabled: true,
automatic_position: 6,
position: 6,
icon: null,
user_field: null,
},
{
id: 7,
name: "days_visited",
type: "automatic",
enabled: true,
automatic_position: 7,
position: 7,
icon: null,
user_field: null,
},
{
id: 9,
name: null,
type: "user_field",
enabled: false,
automatic_position: null,
position: 8,
icon: null,
user_field: {
id: 3,
name: "Favorite Color",
description: "User's favorite color",
field_type: "text",
editable: false,
required: false,
show_on_profile: false,
show_on_user_card: true,
searchable: true,
position: 2,
},
},
],
});
});
pretender.get("/directory-columns.json", () => {
return response(200, {
directory_columns: [
{
id: 1,
name: "likes_received",
type: "automatic",
position: 1,
icon: "heart",
user_field: null,
},
{
id: 2,
name: "likes_given",
type: "automatic",
position: 2,
icon: "heart",
user_field: null,
},
{
id: 3,
name: "topic_count",
type: "automatic",
position: 3,
icon: null,
user_field: null,
},
{
id: 4,
name: "post_count",
type: "automatic",
position: 4,
icon: null,
user_field: null,
},
{
id: 5,
name: "topics_entered",
type: "automatic",
position: 5,
icon: null,
user_field: null,
},
{
id: 6,
name: "posts_read",
type: "automatic",
position: 6,
icon: null,
user_field: null,
},
{
id: 7,
name: "days_visited",
type: "automatic",
position: 7,
icon: null,
user_field: null,
},
{
id: 9,
name: "Favorite Color",
type: "user_field",
position: 8,
icon: null,
user_field_id: 3,
},
],
});
});
}
export function resetPretender() {
instance.handlers = [];
instance.handledRequests = [];
instance.unhandledRequests = [];
instance.passthroughRequests = [];
}