feat(task-90): Complete telemetry integration with /auth/init + fix Roo test brittleness
- Updated telemetry submission to use /auth/init endpoint instead of /api/v1/users - Hardcoded gateway endpoint to http://localhost:4444/api/v1/telemetry for all users - Removed unnecessary service API key complexity - simplified authentication - Enhanced init.js with hosted gateway setup option and user registration - Added configureTelemetrySettings() to update .taskmasterconfig with credentials - Fixed brittle Roo integration tests that required exact string matching - Updated tests to use flexible regex patterns supporting any quote style - All test suites now green: 332 tests passed, 11 skipped, 0 failed - All 11 telemetry tests passing with live gateway integration verified - Ready for ai-services-unified.js integration in subtask 90.3
This commit is contained in:
@@ -1,59 +1,62 @@
|
||||
import { jest } from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
import { execSync } from 'child_process';
|
||||
import { jest } from "@jest/globals";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
describe('Roo Files Inclusion in Package', () => {
|
||||
// This test verifies that the required Roo files are included in the final package
|
||||
describe("Roo Files Inclusion in Package", () => {
|
||||
// This test verifies that the required Roo files are included in the final package
|
||||
|
||||
test('package.json includes assets/** in the "files" array for Roo source files', () => {
|
||||
// Read the package.json file
|
||||
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
test('package.json includes assets/** in the "files" array for Roo source files', () => {
|
||||
// Read the package.json file
|
||||
const packageJsonPath = path.join(process.cwd(), "package.json");
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
||||
|
||||
// Check if assets/** is included in the files array (which contains Roo files)
|
||||
expect(packageJson.files).toContain('assets/**');
|
||||
});
|
||||
// Check if assets/** is included in the files array (which contains Roo files)
|
||||
expect(packageJson.files).toContain("assets/**");
|
||||
});
|
||||
|
||||
test('init.js creates Roo directories and copies files', () => {
|
||||
// Read the init.js file
|
||||
const initJsPath = path.join(process.cwd(), 'scripts', 'init.js');
|
||||
const initJsContent = fs.readFileSync(initJsPath, 'utf8');
|
||||
test("init.js creates Roo directories and copies files", () => {
|
||||
// Read the init.js file
|
||||
const initJsPath = path.join(process.cwd(), "scripts", "init.js");
|
||||
const initJsContent = fs.readFileSync(initJsPath, "utf8");
|
||||
|
||||
// Check for Roo directory creation (using more flexible pattern matching)
|
||||
const hasRooDir = initJsContent.includes(
|
||||
"ensureDirectoryExists(path.join(targetDir, '.roo"
|
||||
);
|
||||
expect(hasRooDir).toBe(true);
|
||||
// Check for Roo directory creation (flexible quote matching)
|
||||
const hasRooDir =
|
||||
/ensureDirectoryExists\(path\.join\(targetDir,\s*['""]\.roo/.test(
|
||||
initJsContent
|
||||
);
|
||||
expect(hasRooDir).toBe(true);
|
||||
|
||||
// Check for .roomodes file copying
|
||||
const hasRoomodes = initJsContent.includes("copyTemplateFile('.roomodes'");
|
||||
expect(hasRoomodes).toBe(true);
|
||||
// Check for .roomodes file copying (flexible quote matching)
|
||||
const hasRoomodes = /copyTemplateFile\(\s*['""]\.roomodes['""]/.test(
|
||||
initJsContent
|
||||
);
|
||||
expect(hasRoomodes).toBe(true);
|
||||
|
||||
// Check for mode-specific patterns (using more flexible pattern matching)
|
||||
const hasArchitect = initJsContent.includes('architect');
|
||||
const hasAsk = initJsContent.includes('ask');
|
||||
const hasBoomerang = initJsContent.includes('boomerang');
|
||||
const hasCode = initJsContent.includes('code');
|
||||
const hasDebug = initJsContent.includes('debug');
|
||||
const hasTest = initJsContent.includes('test');
|
||||
// Check for mode-specific patterns (using more flexible pattern matching)
|
||||
const hasArchitect = initJsContent.includes("architect");
|
||||
const hasAsk = initJsContent.includes("ask");
|
||||
const hasBoomerang = initJsContent.includes("boomerang");
|
||||
const hasCode = initJsContent.includes("code");
|
||||
const hasDebug = initJsContent.includes("debug");
|
||||
const hasTest = initJsContent.includes("test");
|
||||
|
||||
expect(hasArchitect).toBe(true);
|
||||
expect(hasAsk).toBe(true);
|
||||
expect(hasBoomerang).toBe(true);
|
||||
expect(hasCode).toBe(true);
|
||||
expect(hasDebug).toBe(true);
|
||||
expect(hasTest).toBe(true);
|
||||
});
|
||||
expect(hasArchitect).toBe(true);
|
||||
expect(hasAsk).toBe(true);
|
||||
expect(hasBoomerang).toBe(true);
|
||||
expect(hasCode).toBe(true);
|
||||
expect(hasDebug).toBe(true);
|
||||
expect(hasTest).toBe(true);
|
||||
});
|
||||
|
||||
test('source Roo files exist in assets directory', () => {
|
||||
// Verify that the source files for Roo integration exist
|
||||
expect(
|
||||
fs.existsSync(path.join(process.cwd(), 'assets', 'roocode', '.roo'))
|
||||
).toBe(true);
|
||||
expect(
|
||||
fs.existsSync(path.join(process.cwd(), 'assets', 'roocode', '.roomodes'))
|
||||
).toBe(true);
|
||||
});
|
||||
test("source Roo files exist in assets directory", () => {
|
||||
// Verify that the source files for Roo integration exist
|
||||
expect(
|
||||
fs.existsSync(path.join(process.cwd(), "assets", "roocode", ".roo"))
|
||||
).toBe(true);
|
||||
expect(
|
||||
fs.existsSync(path.join(process.cwd(), "assets", "roocode", ".roomodes"))
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user