File tree Expand file tree Collapse file tree 7 files changed +80
-6
lines changed
Expand file tree Collapse file tree 7 files changed +80
-6
lines changed Original file line number Diff line number Diff line change 1+ # App Configuration
2+ NODE_ENV = development
3+ PORT = 7000
4+ APP_URL = http://localhost:7000
5+
6+ # Database
7+ POSTGRES_HOST = postgres
8+ POSTGRES_PORT = 5432
9+ POSTGRES_USER = postgres
10+ POSTGRES_PASSWORD = postgres
11+ POSTGRES_DB = chatbot
12+
13+ # Auth0 Configuration
14+ AUTH0_DOMAIN = your-domain.auth0.com
15+ AUTH0_CLIENT_ID = your-client-id
16+ AUTH0_CLIENT_SECRET = your-client-secret
17+ AUTH0_AUDIENCE = your-api-audience
18+ AUTH0_ISSUER_BASE_URL = https://your-domain.auth0.com
19+
20+ # Twilio Configuration
21+ TWILIO_ACCOUNT_SID = your-account-sid
22+ TWILIO_AUTH_TOKEN = your-auth-token
23+ TWILIO_PHONE_NUMBER = your-twilio-number
24+
25+ # EdX API
26+ EDX_API_KEY = your_edx_api_key
27+ EDX_API_URL = https://api.edx.org
28+ EDX_CLIENT_ID = your_client_id
29+ EDX_CLIENT_SECRET = your_client_secret
30+
31+ # AI Service
32+ AI_API_KEY = your_ai_api_key
33+ AI_MODEL = gpt-4
Original file line number Diff line number Diff line change 1818 "db:create-model" : " sequelize model:generate" ,
1919 "db:drop" : " sequelize db:drop" ,
2020 "db:migrate" : " sequelize db:migrate" ,
21- "db:migrate:test" : " NODE_ENV=test pnpm db:migrate" ,
21+ "db:drop:test" : " node .jest/jest.global-setup.js" ,
22+ "db:create:test" : " node .jest/jest.global-setup.js" ,
23+ "db:migrate:test" : " node .jest/jest.global-setup.js" ,
2224 "db:generate-migration" : " sequelize migration:generate" ,
2325 "db:undo-migration" : " sequelize db:migrate:undo" ,
2426 "db:rollback-migrations" : " sequelize db:migrate:undo:all" ,
Original file line number Diff line number Diff line change 1+ // this should be the imported module for the test
2+ function sum ( a , b ) {
3+ return a + b ;
4+ }
5+
6+ // Test case 1: Basic addition
7+ test ( 'adds 1 + 2 to equal 3' , ( ) => {
8+ expect ( sum ( 1 , 2 ) ) . toBe ( 3 ) ;
9+ } ) ;
10+
11+ // Test case 2: Negative numbers
12+ test ( 'adds -1 + (-1) to equal -2' , ( ) => {
13+ expect ( sum ( - 1 , - 1 ) ) . toBe ( - 2 ) ;
14+ } ) ;
15+
16+ // Test case 3: Zero handling
17+ test ( 'adds 0 + 5 to equal 5' , ( ) => {
18+ expect ( sum ( 0 , 5 ) ) . toBe ( 5 ) ;
19+ } ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,14 @@ const { Sequelize } = require('sequelize');
22const logger = require ( '../config/logger' ) ;
33const { initializeModels } = require ( '../models' ) ;
44const config = require ( './config' ) ;
5- const envConfig = require ( './sequelize-cli.config' ) [ config . env ] ;
5+
6+ // Load configuration
7+ const env = config . env || 'development' ;
8+ const envConfig = require ( './sequelize-cli.config' ) [ env ] ;
9+
10+ if ( ! envConfig ) {
11+ logger . error ( `No database config found for environment: ${ env } ` ) ;
12+ }
613
714const sequelize = new Sequelize (
815 envConfig . database ,
Original file line number Diff line number Diff line change @@ -9,7 +9,22 @@ module.exports = {
99 host : config . postgresHost || 'postgres' ,
1010 port : config . postgresPort ,
1111 dialect : 'postgres' ,
12- logging : config . env === 'development' ? logger . info ( 'development' ) : false ,
12+ logging : config . env === 'development' ? logger . info : false ,
13+ pool : {
14+ max : 5 ,
15+ min : 0 ,
16+ acquire : 30000 ,
17+ idle : 10000
18+ }
19+ } ,
20+ test : { // Add this test environment configuration
21+ username : config . postgresUser ,
22+ password : config . postgresPassword ,
23+ database : config . postgresDb ,
24+ host : config . postgresHost || 'postgres' ,
25+ port : config . postgresPort ,
26+ dialect : 'postgres' ,
27+ logging : false , // Disable logging during tests
1328 pool : {
1429 max : 5 ,
1530 min : 0 ,
@@ -34,13 +49,11 @@ module.exports = {
3449 dialectOptions : {
3550 ssl : {
3651 require : true ,
37- rejectUnauthorized : false // For self-signed certificates
52+ rejectUnauthorized : false
3853 } ,
39- // For connection timeouts
4054 connectTimeout : 60000 ,
4155 keepAlive : true
4256 } ,
43- // Heroku and other cloud providers often use this
4457 ...( config . dbUrl ? { url : config . dbUrl } : { } )
4558 }
4659} ;
You can’t perform that action at this time.
0 commit comments