test: зелёный сьют — синхрон политики пароля (8), jsdom devDep, serial-прогон

Чинит 8 «baseline»-падений (теперь 330/330):
- auth (3): контроллер/фронт требуют пароль >=8, а схема роута (minLen:6) и тест
  (7-симв. 'pass123') устарели → схема register/profile 6→8, тест-пароли → 8 симв.
  (login/duplicate падали как следствие незарегистрированного юзера).
- page (5): jsdom не был установлен → добавлен в devDependencies.
- флакость jsdom-страниц при параллельном прогоне (фикс. wait под нагрузкой CPU) →
  npm test с --test-concurrency=1 (детерминированно; в изоляции тесты и так проходят).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-06-19 16:53:04 +03:00
parent eed8343977
commit 2d7833cad9
4 changed files with 550 additions and 6 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ after(() => cleanup());
describe('Auth', () => {
it('registers a new user', async () => {
const res = await inject('POST', '/api/auth/register', {
email: 'auth1@test.com', password: 'pass123', name: 'Auth User'
email: 'auth1@test.com', password: 'pass1234', name: 'Auth User'
});
assert.equal(res.status, 201);
assert.ok(res.body.token);
@@ -16,7 +16,7 @@ describe('Auth', () => {
it('rejects duplicate email', async () => {
const res = await inject('POST', '/api/auth/register', {
email: 'auth1@test.com', password: 'pass123', name: 'Dupe'
email: 'auth1@test.com', password: 'pass1234', name: 'Dupe'
});
assert.equal(res.status, 409);
});
@@ -42,7 +42,7 @@ describe('Auth', () => {
it('logs in with correct credentials', async () => {
const res = await inject('POST', '/api/auth/login', {
email: 'auth1@test.com', password: 'pass123'
email: 'auth1@test.com', password: 'pass1234'
});
assert.equal(res.status, 200);
assert.ok(res.body.token);