test: add jest test suite with controller specs and mocks

- add jest, ts-jest, supertest, and related dev dependencies
- add test scripts (test, test:debug, test:watch) to package.json
- add jest.config.js with ts-jest transform and module name mappers
- add controller specs for auth, browser, environment, mcp, scenario, session
- add mocks for jsdom, playwright, and readability
- add test/tsconfig.json and exclude test dir from main tsconfig
This commit is contained in:
2026-04-07 15:54:13 +03:00
parent cff36ffeff
commit 00f310e899
15 changed files with 4874 additions and 27 deletions
+6
View File
@@ -0,0 +1,6 @@
export class JSDOM {
constructor(public html: string, public options?: any) {}
get window() {
return { document: {} };
}
}
+15
View File
@@ -0,0 +1,15 @@
export const chromium = {
launch: jest.fn().mockResolvedValue({
newContext: jest.fn().mockResolvedValue({
newPage: jest.fn().mockResolvedValue({
goto: jest.fn(),
content: jest.fn().mockResolvedValue('<html></html>'),
title: jest.fn().mockReturnValue(''),
url: jest.fn().mockReturnValue(''),
evaluate: jest.fn(),
close: jest.fn(),
}),
}),
close: jest.fn(),
}),
};
+6
View File
@@ -0,0 +1,6 @@
export class Readability {
constructor(private doc: any) {}
parse() {
return { textContent: '' };
}
}