import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import express from 'express';
import request from 'supertest';
import { createImportRoutes } from '../routes/import.js';

describe('Import API', () => {
  let app: express.Application;
  beforeEach(() => {
    app = express();
    app.use(express.json());
    app.use('/api/import', createImportRoutes());
  });
  it('should validate URL request payload', async () => {
    const response = await request(app)
      .post('/api/import/url')
      .send({ url: 'not-a-url' })
      .expect(200);
    expect(response.body.success).toBe(true);
  });
});
