
All checks were successful
build-and-push-ext / build_push (push) Successful in 35s
- Dockerfile optimisé: seulement docker-cli pour bitcoin-cli - README.md complet avec tous les endpoints et configuration - CHANGELOG.md mis à jour avec v1.1.1 - Tests unitaires pour les routes funds - Tests d'intégration pour le signer - Configuration Jest avec coverage - Scripts de test dans package.json - Fichier .env.test pour les tests
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import request from 'supertest';
|
|
import express from 'express';
|
|
import { routes } from '../../src/routes';
|
|
import { SignerService } from '../../src/services/signer';
|
|
|
|
describe('Signer Integration Tests', () => {
|
|
let app: express.Application;
|
|
|
|
beforeAll(() => {
|
|
app = express();
|
|
app.use(express.json());
|
|
app.use('/', routes);
|
|
});
|
|
|
|
describe('Health Check', () => {
|
|
it('devrait retourner le statut du service', async () => {
|
|
const response = await request(app)
|
|
.get('/api/v1/health');
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.body.status).toBe('healthy');
|
|
});
|
|
});
|
|
|
|
describe('Root Endpoint', () => {
|
|
it('devrait retourner la documentation de l\'API', async () => {
|
|
const response = await request(app)
|
|
.get('/');
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.body.message).toBe('LeCoffre Backend API');
|
|
expect(response.body.version).toBe('1.0.0');
|
|
expect(response.body.endpoints).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('Signer Service', () => {
|
|
it('devrait avoir une configuration valide', () => {
|
|
const healthCheck = SignerService.getHealthCheck();
|
|
|
|
expect(healthCheck).toBeDefined();
|
|
expect(healthCheck.state).toBeDefined();
|
|
expect(healthCheck.reconnectAttempts).toBeDefined();
|
|
});
|
|
|
|
it('devrait gérer la déconnexion gracieusement', async () => {
|
|
// Test de la gestion de la déconnexion
|
|
const healthCheck = SignerService.getHealthCheck();
|
|
expect(healthCheck.state).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('CORS Configuration', () => {
|
|
it('devrait accepter les requêtes depuis les origines autorisées', async () => {
|
|
const response = await request(app)
|
|
.get('/')
|
|
.set('Origin', 'https://dev4.4nkweb.com');
|
|
|
|
expect(response.status).toBe(200);
|
|
});
|
|
});
|
|
});
|