|
|
|
|
|
|
|
|
|
|
|
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...'); |
|
|
|
|
|
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); |
|
|
|
|
|
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); |
|
|
|
|
|
const testServices = { |
|
authService, |
|
accountService, |
|
postService, |
|
scheduleService, |
|
sourceService, |
|
linkedinAuthService |
|
}; |
|
|
|
Object.entries(testServices).forEach(([serviceName, service]) => { |
|
console.log(`β
[${serviceName}] Service loaded successfully`); |
|
|
|
|
|
const methods = Object.getOwnPropertyNames(service.constructor.prototype) |
|
.filter(name => name !== 'constructor' && typeof service[name] === 'function'); |
|
|
|
console.log(` - Available methods: ${methods.join(', ')}`); |
|
}); |
|
|
|
|
|
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.'); |