stub few ios endpoints

pull/63/head
Sven Sauleau 2023-01-10 15:35:14 +00:00
rodzic 050d6c1878
commit c9cd93033f
6 zmienionych plików z 58 dodań i 0 usunięć

Wyświetl plik

@ -3,6 +3,7 @@ import * as v1_instance from 'wildebeest/functions/api/v1/instance'
import * as v2_instance from 'wildebeest/functions/api/v2/instance'
import * as apps from 'wildebeest/functions/api/v1/apps'
import * as custom_emojis from 'wildebeest/functions/api/v1/custom_emojis'
import * as mutes from 'wildebeest/functions/api/v1/mutes'
import { makeDB, assertCORS, assertJSON, assertCache, createTestClient } from './utils'
import { createPerson } from 'wildebeest/backend/src/activitypub/actors'
import { createSubscription } from '../src/mastodon/subscription'
@ -230,4 +231,13 @@ describe('Mastodon APIs', () => {
assert.equal(count, 1)
})
})
test('mutes returns an empty array', async () => {
const res = await mutes.onRequest()
assert.equal(res.status, 200)
assertJSON(res)
const data = await res.json<any>()
assert.equal(data.length, 0)
})
})

Wyświetl plik

@ -18,6 +18,7 @@ import { createPerson, getPersonById } from 'wildebeest/backend/src/activitypub/
import { addFollowing, acceptFollowing } from 'wildebeest/backend/src/mastodon/follow'
import { insertLike } from 'wildebeest/backend/src/mastodon/like'
import { insertReblog } from 'wildebeest/backend/src/mastodon/reblog'
import * as filters from 'wildebeest/functions/api/v1/filters'
const userKEK = 'test_kek2'
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
@ -841,5 +842,14 @@ describe('Mastodon APIs', () => {
assert.equal(row.count, 0)
})
})
test('view filters return empty array', async () => {
const res = await filters.onRequest()
assert.equal(res.status, 200)
assertJSON(res)
const data = await res.json<any>()
assert.equal(data.length, 0)
})
})
})

Wyświetl plik

@ -1,5 +1,6 @@
import { strict as assert } from 'node:assert/strict'
import * as trends_statuses from 'wildebeest/functions/api/v1/trends/statuses'
import * as trends_links from 'wildebeest/functions/api/v1/trends/links'
import { assertJSON } from '../utils'
describe('Mastodon APIs', () => {
@ -12,5 +13,14 @@ describe('Mastodon APIs', () => {
const data = await res.json<any>()
assert.equal(data.length, 0)
})
test('trending links return empty array', async () => {
const res = await trends_links.onRequest()
assert.equal(res.status, 200)
assertJSON(res)
const data = await res.json<any>()
assert.equal(data.length, 0)
})
})
})

Wyświetl plik

@ -0,0 +1,10 @@
// https://docs.joinmastodon.org/methods/filters/#get-v1
const headers = {
'content-type': 'application/json; charset=utf-8',
}
export const onRequest = async () => {
const out: Array<any> = []
return new Response(JSON.stringify(out), { headers })
}

Wyświetl plik

@ -0,0 +1,8 @@
const headers = {
'content-type': 'application/json; charset=utf-8',
}
export const onRequest = async () => {
const out: Array<any> = []
return new Response(JSON.stringify(out), { headers })
}

Wyświetl plik

@ -0,0 +1,10 @@
// https://docs.joinmastodon.org/methods/trends/#links
const headers = {
'content-type': 'application/json; charset=utf-8',
}
export const onRequest = async () => {
const out: Array<any> = []
return new Response(JSON.stringify(out), { headers })
}