From b0bf0aa0ef9c72bc23797cae17586b8d7b0943e5 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 21 Apr 2024 16:36:50 +0800 Subject: [PATCH] test: add test case for telemetryId gif route --- src/server/router/__test__/telemetry.test.ts | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/server/router/__test__/telemetry.test.ts b/src/server/router/__test__/telemetry.test.ts index 401ddfa..aa9b801 100644 --- a/src/server/router/__test__/telemetry.test.ts +++ b/src/server/router/__test__/telemetry.test.ts @@ -5,6 +5,30 @@ import { generateETag } from '../../utils/common'; describe('telemetry router', () => { const { app, createTestUser, createTestTelemetry } = createTestContext(); + describe('/:telemetryId.gif', () => { + test('normal', async () => { + const { workspace } = await createTestUser(); + const telemetry = await createTestTelemetry(workspace.id); + + const { status } = await app.get( + `/telemetry/${workspace.id}/${telemetry.id}.svg` + ); + + expect(status).toBe(200); + }); + + test('with query', async () => { + const { workspace } = await createTestUser(); + const telemetry = await createTestTelemetry(workspace.id); + + const { status } = await app.get( + `/telemetry/${workspace.id}/${telemetry.id}.svg?name=tianji-oss&url=http://localhost:10000&v=1.8.2` + ); + + expect(status).toBe(200); + }); + }); + describe('/badge', () => { test('check header', async () => { const { workspace } = await createTestUser();