Skip to content

Commit

Permalink
Merge pull request #108 from Open-Cap-Stack/feature/financial-control…
Browse files Browse the repository at this point in the history
…ler-api

Fix update financial report functionality and tests
  • Loading branch information
urbantech authored Nov 12, 2024
2 parents 5622575 + a693610 commit 8908995
Show file tree
Hide file tree
Showing 25 changed files with 1,735 additions and 980 deletions.
173 changes: 0 additions & 173 deletions __tests__/ComprehensiveController.test.js

This file was deleted.

30 changes: 16 additions & 14 deletions __tests__/app.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
const { connectDB, disconnectDB } = require('../db');
const app = require('../app');
// __tests__/setup/test-app.js
const express = require('express');
const mongoose = require('mongoose');
const financialReportingRoutes = require('../../routes/financialReportingRoutes');

let server;
const app = express();

beforeAll(async () => {
await connectDB();
server = app.listen(5001);
});
// Middleware
app.use(express.json());

afterAll(async () => {
await server.close();
await disconnectDB();
});
// Routes - match the path from your main app.js
app.use('/api/financial-reports', financialReportingRoutes);

describe('App Tests', () => {
it('should run the server', async () => {
expect(server).toBeDefined();
// Error handling middleware - match your main app.js format
app.use((err, req, res, next) => {
console.error('Error:', err.message);
res.status(err.statusCode || 500).json({
error: err.message || 'Internal Server Error',
});
});

module.exports = app;
Loading

0 comments on commit 8908995

Please sign in to comment.