forgot the actual files

This commit is contained in:
Ocasta 2025-01-21 23:40:48 -08:00
parent 73334cbe8d
commit a5bfd74c6d
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,37 @@
const { expect } = require('chai');
const vscode = require('vscode');
describe('Extension Tests', function() {
this.timeout(60000); // Increased timeout for extension operations
it('should activate extension successfully', async () => {
// Get the extension
const extension = vscode.extensions.getExtension('saoudrizwan.claude-dev');
expect(extension).to.not.be.undefined;
// Activate the extension if not already activated
if (!extension.isActive) {
await extension.activate();
}
expect(extension.isActive).to.be.true;
});
it('should open sidebar view', async () => {
// Execute the command to open sidebar
await vscode.commands.executeCommand('cline.plusButtonClicked');
// Wait for sidebar to be visible
await new Promise(resolve => setTimeout(resolve, 1000));
// Get all views
const views = vscode.window.visibleTextEditors;
// Just verify the command executed without error
// The actual view verification is handled in the TypeScript tests
});
it('should handle basic commands', async () => {
// Test basic command execution
await vscode.commands.executeCommand('cline.historyButtonClicked');
// Success if no error thrown
});
});

43
src/test/suite/index.js Normal file
View file

@ -0,0 +1,43 @@
const path = require('path');
const Mocha = require('mocha');
const glob = require('glob');
async function run() {
// Create the mocha test
const mocha = new Mocha({
ui: 'bdd',
color: true,
timeout: 60000 // Increased timeout for extension operations
});
const testsRoot = path.resolve(__dirname, '.');
try {
// Find all test files
const files = await glob('*.test.js', { cwd: testsRoot });
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
// Run the mocha test
return new Promise((resolve, reject) => {
try {
// Run the tests
mocha.run(failures => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
reject(err);
}
});
} catch (err) {
console.error('Failed to run tests:', err);
throw err;
}
}
module.exports = { run };