PR-220602: Adding first commit.

This commit is contained in:
2025-01-12 04:24:44 +00:00
commit 5eaec8627f
20 changed files with 5599 additions and 0 deletions

24
__tests__/index.test.ts Normal file
View File

@ -0,0 +1,24 @@
import request from 'supertest';
import express from 'express';
import { setRoutes } from '../src/routes/index';
import dotenv from 'dotenv';
dotenv.config();
const app = express();
setRoutes(app);
describe('GET /', () => {
it('should redirect to CDN URL', async () => {
const response = await request(app).get('/');
expect(response.status).toBe(302);
expect(response.header.location).toBe(process.env.CDN_URL);
});
it('should return 500 if CDN URL is not configured', async () => {
process.env.CDN_URL = '';
const response = await request(app).get('/');
expect(response.status).toBe(500);
expect(response.text).toBe('CDN URL not configured');
});
});