"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const vscode = require("vscode");
const path = require("path");
const sinon = require("sinon");
suite('Extension Integration Test Suite', () => {
    vscode.window.showInformationMessage('Start all integration tests.');
    const testWorkspace = vscode.Uri.file(path.join(__dirname, '..', '..', '..', 'testWorkspace'));
    suiteSetup(() => {
        return vscode.commands.executeCommand('vscode.openFolder', testWorkspace);
    });
    suiteTeardown(() => {
        return vscode.commands.executeCommand('workbench.action.closeFolder');
    });
    test('File Exclusion', async () => {
        // Stubbing the showQuickPick method to simulate user selection
        sinon.stub(vscode.window, 'showQuickPick').resolves({ label: 'test1.js' });
        // Execute the command
        await vscode.commands.executeCommand('extension.prepareForLLM');
        // Verification code to check whether the files were excluded would go here
        // This might involve checking a state variable or reading from a temporary file where you stored this info
        // For demonstration purposes, we'll just assert true
        assert.ok(true, 'Files should be excluded.');
    });
    test('File Selection and Configuration', async () => {
        // Stubbing the showQuickPick method to simulate user selection
        sinon.stub(vscode.window, 'showQuickPick').resolves({ label: 'test1.js' });
        // Execute the command
        await vscode.commands.executeCommand('extension.prepareForLLM');
        // Retrieve and check the configuration
        const selectedFiles = vscode.workspace.getConfiguration('prepareForLLM').get('selectedFiles');
        assert.deepStrictEqual(selectedFiles, ['test1.js'], 'Selected files should be updated in the configuration.');
    });
    test('Token Encoding and Limit', async () => {
        // Set a custom token limit for this test
        await vscode.workspace.getConfiguration('prepareForLLM').update('tokenLimit', 50, vscode.ConfigurationTarget.Workspace);
        // Execute the command
        await vscode.commands.executeCommand('extension.prepareForLLM');
        // Verification code to check token encoding and limit would go here
        // For demonstration purposes, we'll just assert true
        assert.ok(true, 'Token encoding and limit should be as expected.');
    });
    test('Content Generation', async () => {
        // Execute the command
        await vscode.commands.executeCommand('extension.prepareForLLM');
        // Verification code to check that the generated content is as expected would go here
        // For demonstration purposes, we'll just assert true
        assert.ok(true, 'Generated content should be as expected.');
    });
    test('Error Handling', async () => {
        // Set a low token limit to trigger an error
        await vscode.workspace.getConfiguration('prepareForLLM').update('tokenLimit', 1, vscode.ConfigurationTarget.Workspace);
        // Stubbing the showInformationMessage to monitor calls
        const spy = sinon.spy(vscode.window, 'showInformationMessage');
        // Execute the command
        await vscode.commands.executeCommand('extension.prepareForLLM');
        // Check if the error message was shown
        assert.ok(spy.calledWith('Token limit exceeded.'), 'Error message should be shown.');
    });
});
//# sourceMappingURL=extension.integration.test.js.map