import { expect, describe, it, beforeAll } from 'vitest';
import db, { multipleMigrations } from '../../db/database.js';
import * as ActivityService from './activity.service.js';
describe('Activity service integration tests', () => {
    beforeAll(async () => {
        await multipleMigrations();
    });
    it('Should not create an activity without an environment id', async () => {
        const log = {};
        const logId = await ActivityService.createActivityLog(log);
        expect(logId).toBeNull();
    });
    it('Should create an activity log and retrieve its ID', async () => {
        const result = await db.knex.select('*').from('_nango_environments');
        const log = {
            environment_id: result[0].id
        };
        const logId = await ActivityService.createActivityLog(log);
        expect(logId).not.toBeNull();
    });
    it('Should update provider for a given activity log ID', async () => {
        const result = await db.knex.select('*').from('_nango_environments');
        const log = {
            environment_id: result[0].id
        };
        const createdLog = await ActivityService.createActivityLog(log);
        const provider = 'newProvider';
        await ActivityService.updateProvider(createdLog, provider);
        const updatedLog = await db.knex
            .from('_nango_activity_logs')
            .where({ id: createdLog })
            .first();
        expect(updatedLog.provider).toEqual(provider);
    });
});
//# sourceMappingURL=activity.service.integration.test.js.map