fix existing tests after adding chat moderation

This commit is contained in:
Mary Kate 2020-09-11 12:38:32 -05:00 committed by Angelina Filippova
parent f59655995e
commit 0ef644c6cb
2 changed files with 377 additions and 0 deletions

371
src/api/__mocks__/chats.js Normal file
View file

@ -0,0 +1,371 @@
export const userChats = [
{
id: '9y8e7ESoVUiKVMAoCW',
last_message: {
account_id: '9xUIiQfGrdPJDZe39s',
attachment: null,
card: null,
chat_id: '9y8e7ESoVUiKVMAoCW',
content: 'heyy',
created_at: '2020-09-11T00:07:13.000Z',
emojis: [],
id: '9z22Q9MzWiAk7GZnNY',
unread: false
},
receiver: {
acct: 'test10',
avatar: 'http://localhost:4000/images/avi.png',
avatar_static: 'http://localhost:4000/images/avi.png',
bot: false,
created_at: '2020-07-27T00:33:02.000Z',
display_name: 'test10',
emojis: [],
fields: [],
followers_count: 2,
following_count: 1,
header: 'http://localhost:4000/images/banner.png',
header_static: 'http://localhost:4000/images/banner.png',
id: '9xUj5WTmzSlFPN6OLg',
locked: false,
note: '',
pleroma: {
accepts_chat_messages: true,
ap_id: 'http://localhost:4000/users/test10',
background_image: null,
confirmation_pending: false,
favicon: null,
hide_favorites: true,
hide_followers: false,
hide_followers_count: false,
hide_follows: false,
hide_follows_count: false,
is_admin: false,
is_moderator: true,
relationship: {},
skip_thread_containment: false,
tags: [
'mrf_tag:media-force-nsfw',
'mrf_tag:media-strip',
'mrf_tag:force-unlisted'
]
},
source: {
fields: [],
note: '',
pleroma: {
actor_type: 'Person',
discoverable: false
},
sensitive: false
},
statuses_count: 20,
url: 'http://localhost:4000/users/test10',
username: 'test10'
},
sender: {
acct: 'mk',
avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
bot: false,
created_at: '2020-07-26T19:37:31.000Z',
display_name: 'mk',
emojis: [],
fields: [
{
name: 'website',
value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
}
],
followers_count: 2,
following_count: 1,
header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
id: '9xUIiQfGrdPJDZe39s',
locked: false,
note: 'a bio about me',
pleroma: {
accepts_chat_messages: true,
ap_id: 'https://localhost/users/mk',
background_image: null,
confirmation_pending: false,
favicon: null,
hide_favorites: true,
hide_followers: false,
hide_followers_count: false,
hide_follows: false,
hide_follows_count: false,
is_admin: true,
is_moderator: false,
relationship: {},
skip_thread_containment: false,
tags: [
'verified'
]
},
source: {
fields: [
{
name: 'website',
value: 'marykatefain.com'
}
],
note: 'a bio about me',
pleroma: {
actor_type: 'Person',
discoverable: false
},
sensitive: false
},
statuses_count: 77,
url: 'https://localhost/users/mk',
username: 'mk'
},
unread: 0,
updated_at: '2020-09-11T00:07:13.000Z'
},
{
id: '9y8dwDAQzFBZIZJzEG',
last_message: {
account_id: '9xUIiQfGrdPJDZe39s',
attachment: null,
card: null,
chat_id: '9y8dwDAQzFBZIZJzEG',
content: 'hiiiiiiiiiiiiiiiiiii',
created_at: '2020-08-15T06:45:13.000Z',
emojis: [],
id: '9y8e4EZndDmfzA0lGa',
unread: false
},
receiver: {
acct: 'user2',
avatar: 'http://localhost:4000/media/5a702176cd5181f81532a42fafa87953db1586ca39a3c83cd3df1bc9b5cb7d07.png',
avatar_static: 'http://localhost:4000/media/5a702176cd5181f81532a42fafa87953db1586ca39a3c83cd3df1bc9b5cb7d07.png',
bot: false,
created_at: '2020-08-01T19:23:57.000Z',
display_name: 'User2',
emojis: [],
fields: [],
followers_count: 0,
following_count: 2,
header: 'http://localhost:4000/media/1b1fc87d56e4f94b0ca8eb23100c92f67371bfa37b2898cd804341ed1a2d5c84.jpg',
header_static: 'http://localhost:4000/media/1b1fc87d56e4f94b0ca8eb23100c92f67371bfa37b2898cd804341ed1a2d5c84.jpg',
id: '9xfhRuCIyydruc0Sh6',
locked: false,
note: 'Just me!',
pleroma: {
accepts_chat_messages: true,
ap_id: 'http://localhost:4000/users/user2',
background_image: null,
confirmation_pending: true,
favicon: null,
hide_favorites: true,
hide_followers: false,
hide_followers_count: false,
hide_follows: false,
hide_follows_count: false,
is_admin: false,
is_moderator: false,
relationship: {},
skip_thread_containment: false,
tags: [
'mrf_tag:force-unlisted',
'mrf_tag:media-strip'
]
},
source: {
fields: [],
note: 'Just me!',
pleroma: {
actor_type: 'Person',
discoverable: false
},
sensitive: false
},
statuses_count: 69,
url: 'http://localhost:4000/users/user2',
username: 'user2'
},
sender: {
acct: 'mk',
avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
bot: false,
created_at: '2020-07-26T19:37:31.000Z',
display_name: 'mk',
emojis: [],
fields: [
{
name: 'website',
value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
}
],
followers_count: 2,
following_count: 1,
header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
id: '9xUIiQfGrdPJDZe39s',
locked: false,
note: 'a bio about me',
pleroma: {
accepts_chat_messages: true,
ap_id: 'https://localhost/users/mk',
background_image: null,
confirmation_pending: false,
favicon: null,
hide_favorites: true,
hide_followers: false,
hide_followers_count: false,
hide_follows: false,
hide_follows_count: false,
is_admin: true,
is_moderator: false,
relationship: {},
skip_thread_containment: false,
tags: [
'verified'
]
},
source: {
fields: [
{
name: 'website',
value: 'marykatefain.com'
}
],
note: 'a bio about me',
pleroma: {
actor_type: 'Person',
discoverable: false
},
sensitive: false
},
statuses_count: 77,
url: 'https://localhost/users/mk',
username: 'mk'
},
unread: 0,
updated_at: '2020-08-15T06:45:13.000Z'
},
{
id: '9y8dubemxq32fkkoeu',
last_message: null,
receiver: {
acct: 'mk',
avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
bot: false,
created_at: '2020-07-26T19:37:31.000Z',
display_name: 'mk',
emojis: [],
fields: [
{
name: 'website',
value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
}
],
followers_count: 2,
following_count: 1,
header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
id: '9xUIiQfGrdPJDZe39s',
locked: false,
note: 'a bio about me',
pleroma: {
accepts_chat_messages: true,
ap_id: 'https://localhost/users/mk',
background_image: null,
confirmation_pending: false,
favicon: null,
hide_favorites: true,
hide_followers: false,
hide_followers_count: false,
hide_follows: false,
hide_follows_count: false,
is_admin: true,
is_moderator: false,
relationship: {},
skip_thread_containment: false,
tags: [
'verified'
]
},
source: {
fields: [
{
name: 'website',
value: 'marykatefain.com'
}
],
note: 'a bio about me',
pleroma: {
actor_type: 'Person',
discoverable: false
},
sensitive: false
},
statuses_count: 77,
url: 'https://localhost/users/mk',
username: 'mk'
},
sender: {
acct: 'mk',
avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
bot: false,
created_at: '2020-07-26T19:37:31.000Z',
display_name: 'mk',
emojis: [],
fields: [
{
name: 'website',
value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
}
],
followers_count: 2,
following_count: 1,
header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
id: '9xUIiQfGrdPJDZe39s',
locked: false,
note: 'a bio about me',
pleroma: {
accepts_chat_messages: true,
ap_id: 'https://localhost/users/mk',
background_image: null,
confirmation_pending: false,
favicon: null,
hide_favorites: true,
hide_followers: false,
hide_followers_count: false,
hide_follows: false,
hide_follows_count: false,
is_admin: true,
is_moderator: false,
relationship: {},
skip_thread_containment: false,
tags: [
'verified'
]
},
source: {
fields: [
{
name: 'website',
value: 'marykatefain.com'
}
],
note: 'a bio about me',
pleroma: {
actor_type: 'Person',
discoverable: false
},
sensitive: false
},
statuses_count: 77,
url: 'https://localhost/users/mk',
username: 'mk'
},
unread: 0,
updated_at: '2020-08-15T06:43:29.000Z'
}
]

View file

@ -1,3 +1,5 @@
import userChats from './chats'
export let users = [
{ active: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' },
{ active: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: false, external: true, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' },
@ -50,6 +52,10 @@ export async function fetchUserStatuses(id, authHost, godmode, token) {
return Promise.resolve({ data: userStatuses })
}
export async function fetchUserChats(id, authHost, godmode, token) {
return Promise.resolve({ data: userChats })
}
export async function getPasswordResetToken(nickname, authHost, token) {
return Promise.resolve({ data: { token: 'g05lxnBJQnL', link: 'http://url/api/pleroma/password_reset/g05lxnBJQnL' }})
}