Skip to main content
Glama
app.e2e-spec.ts1.29 kB
import { AppModule } from '@/app.module'; import { HttpStatus, INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import * as request from 'supertest'; import { App } from 'supertest/types'; describe('AppController (e2e)', () => { let app: INestApplication<App>; beforeEach(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule], }).compile(); app = moduleFixture.createNestApplication(); app.setGlobalPrefix('api', { exclude: ['', 'hello'] }); await app.init(); }); it('/ (GET) - Redirect to /api/health', () => { return request(app.getHttpServer()) .get('/') .expect(HttpStatus.PERMANENT_REDIRECT) .expect(res => { expect(res.headers.location).toBe('/api/health'); }); }); it('/hello (GET) - Hello World!', () => { return request(app.getHttpServer()) .get('/hello') .expect(200) .expect('Hello World!'); }); it('/health (GET) - Health check', () => { return request(app.getHttpServer()) .get('/api/health') .expect(200) .expect(res => { expect(res.body).toEqual({ status: 'OK', timestamp: expect.any(String), }); }); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/javascripto/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server