Add full test suite with unit, integration, and E2E smoke tests.

Introduce test.bat orchestrating Go/Vitest/Playwright phases, expand coverage across server, agent, and dashboard, and document in tests/README.md.
This commit is contained in:
drjones
2026-05-29 10:04:52 -07:00
parent f9e26bb1a6
commit e55f11a657
23 changed files with 1052 additions and 12 deletions

View File

@@ -0,0 +1,26 @@
/**
* @vitest-environment happy-dom
*/
import { beforeEach, describe, expect, it } from 'vitest';
import { authHeaders, clearStoredAuth, getStoredAuth, setStoredAuth } from '../api/auth';
describe('auth session helpers', () => {
beforeEach(() => {
sessionStorage.clear();
});
it('stores and retrieves basic token', () => {
setStoredAuth('drjones', 'secret');
expect(getStoredAuth()).toBe(btoa('drjones:secret'));
});
it('builds Authorization header when logged in', () => {
setStoredAuth('user', 'pass');
expect(authHeaders()).toEqual({ Authorization: `Basic ${btoa('user:pass')}` });
});
it('returns empty headers when logged out', () => {
clearStoredAuth();
expect(authHeaders()).toEqual({});
});
});