From 08ac081b37cd6115634e8951608116fe0f13032b Mon Sep 17 00:00:00 2001 From: Kimsible Date: Wed, 28 Apr 2021 18:26:26 +0200 Subject: Add test for API actors route --- server/tests/api/check-params/actors.ts | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 server/tests/api/check-params/actors.ts (limited to 'server/tests/api/check-params/actors.ts') diff --git a/server/tests/api/check-params/actors.ts b/server/tests/api/check-params/actors.ts new file mode 100644 index 000000000..3a03edc39 --- /dev/null +++ b/server/tests/api/check-params/actors.ts @@ -0,0 +1,37 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ + +import 'mocha' + +import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils' +import { getActor } from '../../../../shared/extra-utils/actors/actors' +import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' + +describe('Test actors API validators', function () { + let server: ServerInfo + + // --------------------------------------------------------------- + + before(async function () { + this.timeout(30000) + + server = await flushAndRunServer(1) + }) + + describe('When getting an actor', function () { + it('Should return 404 with a non existing actorName', async function () { + await getActor(server.url, 'arfaze', HttpStatusCode.NOT_FOUND_404) + }) + + it('Should return 200 with an existing accountName', async function () { + await getActor(server.url, 'root', HttpStatusCode.OK_200) + }) + + it('Should return 200 with an existing channelName', async function () { + await getActor(server.url, 'root_channel', HttpStatusCode.OK_200) + }) + }) + + after(async function () { + await cleanupTests([ server ]) + }) +}) -- cgit v1.2.3