X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Ffollows.ts;h=2c2224a452b848a972362b6d06505b76ee78ec47;hb=3b0bd70aa05ab82fa30fe67ed4899d44652c703a;hp=02f47c2bb1909da27f73b8a299eec1ea6a1f4e4c;hpb=210feb6cc484a6c5c63c98f770de34e223f944cb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index 02f47c2bb..2c2224a45 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts @@ -1,9 +1,15 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { - createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers, + cleanupTests, + createUser, + flushAndRunServer, + makeDeleteRequest, makeGetRequest, + makePostBodyRequest, + ServerInfo, + setAccessTokensToServers, userLogin } from '../../../../shared/extra-utils' import { @@ -125,6 +131,38 @@ describe('Test server follows API validators', function () { it('Should fail with an incorrect sort', async function () { await checkBadSortPagination(server.url, path) }) + + it('Should fail with an incorrect state', async function () { + await makeGetRequest({ + url: server.url, + path, + query: { + state: 'blabla' + } + }) + }) + + it('Should fail with an incorrect actor type', async function () { + await makeGetRequest({ + url: server.url, + path, + query: { + actorType: 'blabla' + } + }) + }) + + it('Should fail succeed with the correct params', async function () { + await makeGetRequest({ + url: server.url, + path, + statusCodeExpected: 200, + query: { + state: 'accepted', + actorType: 'Application' + } + }) + }) }) describe('When listing followers', function () { @@ -141,6 +179,38 @@ describe('Test server follows API validators', function () { it('Should fail with an incorrect sort', async function () { await checkBadSortPagination(server.url, path) }) + + it('Should fail with an incorrect actor type', async function () { + await makeGetRequest({ + url: server.url, + path, + query: { + actorType: 'blabla' + } + }) + }) + + it('Should fail with an incorrect state', async function () { + await makeGetRequest({ + url: server.url, + path, + query: { + state: 'blabla', + actorType: 'Application' + } + }) + }) + + it('Should fail succeed with the correct params', async function () { + await makeGetRequest({ + url: server.url, + path, + statusCodeExpected: 200, + query: { + state: 'accepted' + } + }) + }) }) describe('When removing a follower', function () { @@ -295,7 +365,7 @@ describe('Test server follows API validators', function () { }) }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) })