import { test, describe } from 'node:test';
import { strict as assert } from 'node:assert';
import { existsSync } from 'fs';
import { readFileSync } from 'fs';
import { join } from 'path';
describe('Matrix Pattern MCP Server Setup', () => {
test('should have all required directories', () => {
const requiredDirs = [
'.matrix_pattern',
'.matrix_pattern/matrix',
'.matrix_pattern/metadata',
'.matrix_pattern/metadata/horizontals',
'.matrix_pattern/metadata/sync-reports',
'.matrix_pattern/metadata/sync-reports/horizontal',
'.matrix_pattern/metadata/sync-reports/vertical',
'src',
'src/test'
];
requiredDirs.forEach(dir => {
assert.ok(existsSync(dir), `Directory ${dir} should exist`);
});
});
test('should have valid configuration file', () => {
const configPath = '.matrix_pattern/config.json';
assert.ok(existsSync(configPath), 'Configuration file should exist');
const configContent = readFileSync(configPath, 'utf8');
let config;
assert.doesNotThrow(() => {
config = JSON.parse(configContent);
}, 'Configuration should be valid JSON');
assert.ok(config.matrix_pattern, 'Configuration should have matrix_pattern section');
assert.ok(config.matrix_pattern.version, 'Configuration should have version');
assert.ok(config.matrix_pattern.directories, 'Configuration should have directories section');
});
test('should have package.json with required dependencies', () => {
const packagePath = 'package.json';
assert.ok(existsSync(packagePath), 'package.json should exist');
const packageContent = readFileSync(packagePath, 'utf8');
let packageData;
assert.doesNotThrow(() => {
packageData = JSON.parse(packageContent);
}, 'package.json should be valid JSON');
assert.ok(packageData.dependencies, 'package.json should have dependencies');
assert.ok(packageData.dependencies['@modelcontextprotocol/sdk'], 'Should have MCP SDK dependency');
assert.ok(packageData.scripts, 'package.json should have scripts');
assert.ok(packageData.scripts.start, 'Should have start script');
});
test('should have executable setup script', () => {
const setupPath = 'setup.sh';
assert.ok(existsSync(setupPath), 'setup.sh should exist');
});
test('should have .gitignore file', () => {
const gitignorePath = '.gitignore';
assert.ok(existsSync(gitignorePath), '.gitignore should exist');
const gitignoreContent = readFileSync(gitignorePath, 'utf8');
assert.ok(gitignoreContent.includes('node_modules/'), '.gitignore should exclude node_modules');
assert.ok(gitignoreContent.includes('.matrix_pattern/logs/'), '.gitignore should exclude logs');
});
});