X-Git-Url: http://these/git/?a=blobdiff_plain;f=api_tests%2Fsrc%2Fshared.ts;fp=ui%2Fsrc%2Fapi_tests%2Fshared.ts;h=6444b8122ac03ba36ec0a61f8a88bf6a55be566e;hb=5c6258390c46159c16f49295314c6519215fc6ae;hp=eb4c6da03a5d72631544b742cd0b72c4f8f04a5f;hpb=b69524b498983da636b3a31f5acb74fbb1f13ab4;p=lemmy.git diff --git a/ui/src/api_tests/shared.ts b/api_tests/src/shared.ts similarity index 92% rename from ui/src/api_tests/shared.ts rename to api_tests/src/shared.ts index eb4c6da0..6444b812 100644 --- a/ui/src/api_tests/shared.ts +++ b/api_tests/src/shared.ts @@ -50,23 +50,23 @@ export interface API { } export let alpha: API = { - client: new LemmyHttp('http://localhost:8540/api/v1'), + client: new LemmyHttp('http://localhost:8541/api/v1'), }; export let beta: API = { - client: new LemmyHttp('http://localhost:8550/api/v1'), + client: new LemmyHttp('http://localhost:8551/api/v1'), }; export let gamma: API = { - client: new LemmyHttp('http://localhost:8560/api/v1'), + client: new LemmyHttp('http://localhost:8561/api/v1'), }; export let delta: API = { - client: new LemmyHttp('http://localhost:8570/api/v1'), + client: new LemmyHttp('http://localhost:8571/api/v1'), }; export let epsilon: API = { - client: new LemmyHttp('http://localhost:8580/api/v1'), + client: new LemmyHttp('http://localhost:8581/api/v1'), }; export async function setupLogins() { @@ -120,8 +120,12 @@ export async function createPost( community_id: number ): Promise { let name = 'A jest test post'; + let body = 'Some body'; + let url = 'https://google.com/'; let form: PostForm = { name, + url, + body, auth: api.auth, community_id, nsfw: false, @@ -232,7 +236,20 @@ export async function searchForBetaCommunity( // Make sure lemmy-beta/c/main is cached on lemmy_alpha // Use short-hand search url let form: SearchForm = { - q: '!main@lemmy-beta:8550', + q: '!main@lemmy-beta:8551', + type_: SearchType.Communities, + sort: SortType.TopAll, + }; + return api.client.search(form); +} + +export async function searchForCommunity( + api: API, + q: string, +): Promise { + // Use short-hand search url + let form: SearchForm = { + q, type_: SearchType.Communities, sort: SortType.TopAll, }; @@ -369,9 +386,15 @@ export async function createCommunity( api: API, name_: string = randomString(5) ): Promise { + let description = 'a sample description'; + let icon = 'https://image.flaticon.com/icons/png/512/35/35896.png'; + let banner = 'https://image.flaticon.com/icons/png/512/35/35896.png'; let form: CommunityForm = { name: name_, title: name_, + description, + icon, + banner, category_id: 1, nsfw: false, auth: api.auth,