1- import { describe , test , expect , beforeAll , afterAll , beforeEach } from 'vitest' ;
2- import { testNodeApi , testPythonApi , setupIntegrationTestEnv , cleanupIntegrationTestEnv } from '../utils/apiTestUtils' ;
3- import { createTestUser , createTestState } from '../utils/testUtils' ;
1+ import { describe , test , expect , beforeAll , afterAll } from "vitest" ;
2+ import {
3+ testNodeApi ,
4+ testPythonApi ,
5+ setupIntegrationTestEnv ,
6+ cleanupIntegrationTestEnv ,
7+ } from "../utils/apiTestUtils" ;
8+ import { createTestUser , createTestState } from "../utils/testUtils" ;
49
510// These tests require the backends to be running
611// Run with: npm run test:integration
7- describe ( ' API Integration Tests' , ( ) => {
12+ describe ( " API Integration Tests" , ( ) => {
813 beforeAll ( ( ) => {
914 setupIntegrationTestEnv ( ) ;
1015 } ) ;
@@ -13,8 +18,8 @@ describe('API Integration Tests', () => {
1318 cleanupIntegrationTestEnv ( ) ;
1419 } ) ;
1520
16- describe ( ' Node.js Backend API Integration' , ( ) => {
17- test ( ' should connect to Node.js backend health endpoint' , async ( ) => {
21+ describe ( " Node.js Backend API Integration" , ( ) => {
22+ test ( " should connect to Node.js backend health endpoint" , async ( ) => {
1823 try {
1924 const response = await testNodeApi . healthCheck ( ) ;
2025 expect ( response . status ) . toBe ( 200 ) ;
@@ -24,23 +29,23 @@ describe('API Integration Tests', () => {
2429 }
2530 } ) ;
2631
27- test ( ' should fetch users from Node.js backend' , async ( ) => {
32+ test ( " should fetch users from Node.js backend" , async ( ) => {
2833 try {
2934 const response = await testNodeApi . getUsers ( ) ;
3035 expect ( response . status ) . toBe ( 200 ) ;
31- expect ( response . data ) . toHaveProperty ( ' users' ) ;
36+ expect ( response . data ) . toHaveProperty ( " users" ) ;
3237 expect ( Array . isArray ( response . data . users ) ) . toBe ( true ) ;
3338 } catch ( error ) {
3439 expect ( true ) . toBe ( true ) ;
3540 }
3641 } ) ;
3742
38- test ( ' should create user via Node.js backend' , async ( ) => {
43+ test ( " should create user via Node.js backend" , async ( ) => {
3944 try {
4045 const testUser = createTestUser ( {
41- firstName : ' Integration' ,
42- lastName : ' Test' ,
43- dateOfBirth : ' 1990-01-01' ,
46+ firstName : " Integration" ,
47+ lastName : " Test" ,
48+ dateOfBirth : " 1990-01-01" ,
4449 } ) ;
4550
4651 const response = await testNodeApi . createUser ( testUser ) ;
@@ -51,11 +56,11 @@ describe('API Integration Tests', () => {
5156 }
5257 } ) ;
5358
54- test ( ' should handle validation errors from Node.js backend' , async ( ) => {
59+ test ( " should handle validation errors from Node.js backend" , async ( ) => {
5560 try {
5661 const invalidUser = createTestUser ( {
57- firstName : '' , // Invalid: empty first name
58- lastName : '' , // Invalid: empty last name
62+ firstName : "" , // Invalid: empty first name
63+ lastName : "" , // Invalid: empty last name
5964 } ) ;
6065
6166 await testNodeApi . createUser ( invalidUser ) ;
@@ -68,8 +73,8 @@ describe('API Integration Tests', () => {
6873 } ) ;
6974 } ) ;
7075
71- describe ( ' Python Backend API Integration' , ( ) => {
72- test ( ' should connect to Python backend health endpoint' , async ( ) => {
76+ describe ( " Python Backend API Integration" , ( ) => {
77+ test ( " should connect to Python backend health endpoint" , async ( ) => {
7378 try {
7479 const response = await testPythonApi . healthCheck ( ) ;
7580 expect ( response . status ) . toBe ( 200 ) ;
@@ -78,7 +83,7 @@ describe('API Integration Tests', () => {
7883 }
7984 } ) ;
8085
81- test ( ' should fetch states from Python backend' , async ( ) => {
86+ test ( " should fetch states from Python backend" , async ( ) => {
8287 try {
8388 const response = await testPythonApi . getStates ( ) ;
8489 expect ( response . status ) . toBe ( 200 ) ;
@@ -88,11 +93,11 @@ describe('API Integration Tests', () => {
8893 }
8994 } ) ;
9095
91- test ( ' should create state via Python backend' , async ( ) => {
96+ test ( " should create state via Python backend" , async ( ) => {
9297 try {
9398 const testState = createTestState ( {
94- name : ' Integration Test State' ,
95- description : ' Created by integration test' ,
99+ name : " Integration Test State" ,
100+ description : " Created by integration test" ,
96101 is_active : true ,
97102 sort_order : 999 ,
98103 } ) ;
@@ -105,11 +110,11 @@ describe('API Integration Tests', () => {
105110 }
106111 } ) ;
107112
108- test ( ' should handle validation errors from Python backend' , async ( ) => {
113+ test ( " should handle validation errors from Python backend" , async ( ) => {
109114 try {
110115 const invalidState = createTestState ( {
111- name : '' , // Invalid: empty name
112- description : '' ,
116+ name : "" , // Invalid: empty name
117+ description : "" ,
113118 } ) ;
114119
115120 await testPythonApi . createState ( invalidState ) ;
@@ -122,8 +127,8 @@ describe('API Integration Tests', () => {
122127 } ) ;
123128 } ) ;
124129
125- describe ( ' Cross-Backend Integration' , ( ) => {
126- test ( ' should verify both backends are accessible' , async ( ) => {
130+ describe ( " Cross-Backend Integration" , ( ) => {
131+ test ( " should verify both backends are accessible" , async ( ) => {
127132 let nodeBackendAvailable = false ;
128133 let pythonBackendAvailable = false ;
129134
@@ -145,7 +150,7 @@ describe('API Integration Tests', () => {
145150 expect ( nodeBackendAvailable || pythonBackendAvailable ) . toBe ( true ) ;
146151 } ) ;
147152
148- test ( ' should handle different response formats from different backends' , async ( ) => {
153+ test ( " should handle different response formats from different backends" , async ( ) => {
149154 let nodeResponse = null ;
150155 let pythonResponse = null ;
151156
@@ -166,7 +171,7 @@ describe('API Integration Tests', () => {
166171 // If both responses are available, verify they have different structures
167172 if ( nodeResponse && pythonResponse ) {
168173 // Node.js returns { users: [...] }
169- expect ( nodeResponse ) . toHaveProperty ( ' users' ) ;
174+ expect ( nodeResponse ) . toHaveProperty ( " users" ) ;
170175 // Python returns [...] directly
171176 expect ( Array . isArray ( pythonResponse ) ) . toBe ( true ) ;
172177 }
0 commit comments