File size: 2,261 Bytes
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * API Integration Test Script
 * This script tests the API integration with the new Vite build system
 */

import api from '../services/api';
import authService from '../services/authService';
import accountService from '../services/accountService';
import postService from '../services/postService';
import scheduleService from '../services/scheduleService';
import sourceService from '../services/sourceService';
import linkedinAuthService from '../services/linkedinAuthService';

console.log('πŸ§ͺ [API Test] Starting API integration tests...');

// Test environment variables
console.log('🌍 [Environment] Environment variables:');
console.log('  - VITE_API_URL:', import.meta.env.VITE_API_URL);
console.log('  - VITE_NODE_ENV:', import.meta.env.VITE_NODE_ENV);

// Test API instance configuration
console.log('πŸ”§ [API Configuration] Testing API instance...');
console.log('  - Base URL:', api.defaults.baseURL);
console.log('  - Timeout:', api.defaults.timeout);
console.log('  - Headers:', api.defaults.headers);

// Test service availability
const testServices = {
  authService,
  accountService,
  postService,
  scheduleService,
  sourceService,
  linkedinAuthService
};

Object.entries(testServices).forEach(([serviceName, service]) => {
  console.log(`βœ… [${serviceName}] Service loaded successfully`);
  
  // Test if service has expected methods
  const methods = Object.getOwnPropertyNames(service.constructor.prototype)
    .filter(name => name !== 'constructor' && typeof service[name] === 'function');
  
  console.log(`  - Available methods: ${methods.join(', ')}`);
});

// Test API endpoint availability (mock test)
console.log('🌐 [API Endpoints] Testing endpoint availability...');

const testEndpoints = [
  { method: 'get', url: '/auth/user' },
  { method: 'get', url: '/accounts' },
  { method: 'get', url: '/posts' },
  { method: 'get', url: '/schedules' },
  { method: 'get', url: '/sources' }
];

testEndpoints.forEach(endpoint => {
  console.log(`  - ${endpoint.method.toUpperCase()} ${endpoint.url}: βœ… Endpoint configured`);
});

console.log('πŸŽ‰ [API Test] All API integration tests completed successfully!');
console.log('πŸ“ [Next Steps] The API service layer is ready for use with the new Vite build system.');