Mock all api functions in mocks for tests
This commit is contained in:
parent
fedb634c48
commit
be6a3781d1
10 changed files with 127 additions and 225 deletions
51
src/api/__mocks__/emojiPacks.js
Normal file
51
src/api/__mocks__/emojiPacks.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
export async function addNewEmojiFile(packName, file, shortcode, filename, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export function addressOfEmojiInPack(host, packName, name) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function createPack(host, token, packName) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function deleteEmojiFile(packName, shortcode, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function deletePack(host, token, packName) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function downloadFrom(instanceAddress, packName, as, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function fetchPack(packName, page, pageSize, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function importFromFS(host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function listPacks(page, pageSize, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function listRemotePacks(instance, page, pageSize, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function reloadEmoji(host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function savePackMetadata(host, token, packName, metadata) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function updateEmojiFile(packName, shortcode, newShortcode, newFilename, force, host, token) {
|
||||
return Promise.resolve()
|
||||
}
|
|
@ -16,5 +16,5 @@ export async function removeBannedUrls(urls, authHost, token) {
|
|||
}
|
||||
|
||||
export async function searchBannedUrls(query, page, pageSize, authHost, token) {
|
||||
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
|
3
src/api/__mocks__/mediaUpload.js
Normal file
3
src/api/__mocks__/mediaUpload.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
export function uploadMedia({ formData, authHost }) {
|
||||
return Promise.resolve()
|
||||
}
|
11
src/api/__mocks__/moderationLog.js
Normal file
11
src/api/__mocks__/moderationLog.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
export async function fetchLog(authHost, token, params, page = 1) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function fetchAdmins(authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function fetchModerators(authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
11
src/api/__mocks__/relays.js
Normal file
11
src/api/__mocks__/relays.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
export async function fetchRelays(authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function addRelay(relay_url, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function deleteRelay(relay_url, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
|
@ -21,11 +21,19 @@ export async function changeState(reportsData, authHost, token) {
|
|||
return Promise.resolve({ data: '' })
|
||||
}
|
||||
|
||||
export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
|
||||
const status = reports[4].statuses[0]
|
||||
return Promise.resolve({ data: { ...status, sensitive, visibility }})
|
||||
}
|
||||
|
||||
export async function deleteStatus(statusId, authHost, token) {
|
||||
export async function createNote(content, reportID, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function deleteNote(noteID, reportID, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
// export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
|
||||
// const status = reports[4].statuses[0]
|
||||
// return Promise.resolve({ data: { ...status, sensitive, visibility }})
|
||||
// }
|
||||
|
||||
// export async function deleteStatus(statusId, authHost, token) {
|
||||
// return Promise.resolve()
|
||||
// }
|
||||
|
|
|
@ -41,3 +41,19 @@ export async function getInstanceDocument(name, authHost, token) {
|
|||
export async function updateSettings(configs, authHost, token) {
|
||||
return Promise.resolve({ data: configAfterUpdate })
|
||||
}
|
||||
|
||||
export async function deleteInstanceDocument(name, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function fetchDescription(authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function updateInstanceDocument(name, formData, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function removeSettings(configs, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
|
|
@ -91,3 +91,7 @@ export async function fetchStatusesCount(instance, authHost, token) {
|
|||
}
|
||||
return Promise.resolve({ data })
|
||||
}
|
||||
|
||||
export async function fetchStatuses({ godmode, localOnly, authHost, token, pageSize, page }) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
|
|
@ -123,3 +123,19 @@ export async function createNewAccount(nickname, email, password, authHost, toke
|
|||
export async function updateUserCredentials(nickname, credentials, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function disableMfa(nickname, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function forcePasswordReset(nicknames, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function confirmUserEmail(nicknames, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export async function resendConfirmationEmail(nicknames, authHost, token) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
|
|
@ -1,218 +0,0 @@
|
|||
export const reports = [
|
||||
{
|
||||
id: '1',
|
||||
timestamp: '2019/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #1', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Nick', text: 'Lorem ipsum', id: '1', timestamp: '2019/4/13' },
|
||||
{ author: 'Val', text: 'dolor sit amet', id: '2', timestamp: '2019/4/13' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
timestamp: '2019/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #2',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Tony', text: 'consectetur adipiscing elit', id: '3', timestamp: '2019/4/2' },
|
||||
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '4', timestamp: '2019/4/3' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
timestamp: '2019/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #3',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '5', timestamp: '2019/3/1' }]
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
timestamp: '2019/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #4', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Nick', text: 'Lorem ipsum', id: '6', timestamp: '2019/4/13' },
|
||||
{ author: 'Val', text: 'dolor sit amet', id: '7', timestamp: '2019/4/13' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
timestamp: '2019/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #5',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Tony', text: 'consectetur adipiscing elit', id: '8', timestamp: '2019/4/2' },
|
||||
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '9', timestamp: '2019/4/3' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '6',
|
||||
timestamp: '2019/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #6',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '10', timestamp: '2019/3/1' }]
|
||||
},
|
||||
{
|
||||
id: '7',
|
||||
timestamp: '2019/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #7', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Nick', text: 'Lorem ipsum', id: '11', timestamp: '2019/4/13' },
|
||||
{ author: 'Val', text: 'dolor sit amet', id: '12', timestamp: '2019/4/13' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '8',
|
||||
timestamp: '2019/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #8',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Tony', text: 'consectetur adipiscing elit', id: '13', timestamp: '2019/4/2' },
|
||||
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '14', timestamp: '2019/4/3' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '9',
|
||||
timestamp: '2019/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #9',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '15', timestamp: '2019/3/1' }]
|
||||
},
|
||||
{
|
||||
id: '10',
|
||||
timestamp: '2019/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #10', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Nick', text: 'Lorem ipsum', id: '16', timestamp: '2019/4/13' },
|
||||
{ author: 'Val', text: 'dolor sit amet', id: '17', timestamp: '2019/4/13' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '11',
|
||||
timestamp: '2019/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #11',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Tony', text: 'consectetur adipiscing elit', id: '18', timestamp: '2019/4/2' },
|
||||
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '19', timestamp: '2019/4/3' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '12',
|
||||
timestamp: '2019/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #12',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '20', timestamp: '2019/3/1' }]
|
||||
},
|
||||
{
|
||||
id: '13',
|
||||
timestamp: '2019/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #13', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Nick', text: 'Lorem ipsum', id: '21', timestamp: '2019/4/13' },
|
||||
{ author: 'Val', text: 'dolor sit amet', id: '22', timestamp: '2019/4/13' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '14',
|
||||
timestamp: '2019/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #14',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Tony', text: 'consectetur adipiscing elit', id: '23', timestamp: '2019/4/2' },
|
||||
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '24', timestamp: '2019/4/3' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '15',
|
||||
timestamp: '2019/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #15',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '25', timestamp: '2019/3/1' }]
|
||||
},
|
||||
{
|
||||
id: '16',
|
||||
timestamp: '2019/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #16', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Nick', text: 'Lorem ipsum', id: '26', timestamp: '2019/4/13' },
|
||||
{ author: 'Val', text: 'dolor sit amet', id: '27', timestamp: '2019/4/13' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '17',
|
||||
timestamp: '2019/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #17',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [
|
||||
{ author: 'Tony', text: 'consectetur adipiscing elit', id: '28', timestamp: '2019/4/2' },
|
||||
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '29', timestamp: '2019/4/3' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '18',
|
||||
timestamp: '2019/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #18',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '30', timestamp: '2019/3/1' }]
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue