add/update tests
This commit is contained in:
33
tests/integration/cursor-init-functionality.test.js
Normal file
33
tests/integration/cursor-init-functionality.test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
describe('Cursor Profile Initialization Functionality', () => {
|
||||
let cursorProfileContent;
|
||||
|
||||
beforeAll(() => {
|
||||
const cursorJsPath = path.join(process.cwd(), 'scripts', 'profiles', 'cursor.js');
|
||||
cursorProfileContent = fs.readFileSync(cursorJsPath, 'utf8');
|
||||
});
|
||||
|
||||
test('cursor.js exports correct brandName and rulesDir', () => {
|
||||
expect(cursorProfileContent).toContain("const brandName = 'Cursor'");
|
||||
expect(cursorProfileContent).toContain("const rulesDir = '.cursor/rules'");
|
||||
});
|
||||
|
||||
test('cursor.js preserves .mdc filenames in fileMap', () => {
|
||||
expect(cursorProfileContent).toContain('fileMap = {');
|
||||
// Should NOT contain any .md mapping
|
||||
expect(cursorProfileContent).not.toMatch(/\.md'/);
|
||||
});
|
||||
|
||||
test('cursor.js contains tool naming logic and global replacements', () => {
|
||||
expect(cursorProfileContent).toContain('edit_file');
|
||||
expect(cursorProfileContent).toContain('search tool');
|
||||
expect(cursorProfileContent).not.toContain('apply_diff');
|
||||
expect(cursorProfileContent).not.toContain('search_files tool');
|
||||
});
|
||||
|
||||
test('cursor.js contains correct documentation URL logic', () => {
|
||||
expect(cursorProfileContent).toContain('docs.cursor.com');
|
||||
});
|
||||
});
|
||||
42
tests/integration/rules-files-inclusion.test.js
Normal file
42
tests/integration/rules-files-inclusion.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
describe('Rules Files Inclusion in Package', () => {
|
||||
test('package.json includes assets/** in the "files" array for rules files', () => {
|
||||
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
expect(packageJson.files).toContain('assets/**');
|
||||
});
|
||||
|
||||
test('all rules files exist in assets/rules directory', () => {
|
||||
const rulesDir = path.join(process.cwd(), 'assets', 'rules');
|
||||
const expectedFiles = [
|
||||
'ai_providers.mdc',
|
||||
'ai_services.mdc',
|
||||
'architecture.mdc',
|
||||
'changeset.mdc',
|
||||
'commands.mdc',
|
||||
'cursor_rules.mdc',
|
||||
'dependencies.mdc',
|
||||
'dev_workflow.mdc',
|
||||
'glossary.mdc',
|
||||
'mcp.mdc',
|
||||
'new_features.mdc',
|
||||
'self_improve.mdc',
|
||||
'taskmaster.mdc',
|
||||
'tasks.mdc',
|
||||
'tests.mdc',
|
||||
'ui.mdc',
|
||||
'utilities.mdc',
|
||||
];
|
||||
for (const file of expectedFiles) {
|
||||
expect(fs.existsSync(path.join(rulesDir, file))).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
test('assets/rules directory is not empty', () => {
|
||||
const rulesDir = path.join(process.cwd(), 'assets', 'rules');
|
||||
const files = fs.readdirSync(rulesDir).filter(f => !f.startsWith('.'));
|
||||
expect(files.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
36
tests/integration/windsurf-init-functionality.test.js
Normal file
36
tests/integration/windsurf-init-functionality.test.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
describe('Windsurf Profile Initialization Functionality', () => {
|
||||
let windsurfProfileContent;
|
||||
|
||||
beforeAll(() => {
|
||||
const windsurfJsPath = path.join(process.cwd(), 'scripts', 'profiles', 'windsurf.js');
|
||||
windsurfProfileContent = fs.readFileSync(windsurfJsPath, 'utf8');
|
||||
});
|
||||
|
||||
test('windsurf.js exports correct brandName and rulesDir', () => {
|
||||
expect(windsurfProfileContent).toContain("const brandName = 'Windsurf'");
|
||||
expect(windsurfProfileContent).toContain("const rulesDir = '.windsurf/rules'");
|
||||
});
|
||||
|
||||
test('windsurf.js contains fileMap for .mdc to .md mapping', () => {
|
||||
expect(windsurfProfileContent).toContain("fileMap = {");
|
||||
expect(windsurfProfileContent).toContain(".mdc'");
|
||||
expect(windsurfProfileContent).toContain(".md'");
|
||||
});
|
||||
|
||||
test('windsurf.js contains tool renaming and extension logic', () => {
|
||||
expect(windsurfProfileContent).toContain("edit_file");
|
||||
expect(windsurfProfileContent).toContain("apply_diff");
|
||||
expect(windsurfProfileContent).toContain("search tool");
|
||||
expect(windsurfProfileContent).toContain("search_files tool");
|
||||
expect(windsurfProfileContent).toContain(".mdc");
|
||||
expect(windsurfProfileContent).toContain(".md");
|
||||
});
|
||||
|
||||
test('windsurf.js contains correct documentation URL transformation', () => {
|
||||
expect(windsurfProfileContent).toContain('docs.cursor.com');
|
||||
expect(windsurfProfileContent).toContain('docs.windsurf.com');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user