Skip to content

test: add submission integrity integration tests - #34

Open
R37R00 wants to merge 7 commits into
devfrom
test/submissions-score-integrity
Open

test: add submission integrity integration tests#34
R37R00 wants to merge 7 commits into
devfrom
test/submissions-score-integrity

Conversation

@R37R00

@R37R00 R37R00 commented Jul 29, 2026

Copy link
Copy Markdown

Added integration tests for submission score integrity.

Covered cases:

Prevent double scoring for the same flag
Multi-flag scoring per team
Concurrent submissions
Incorrect flag submissions without score creation
Serialization conflict handling (P2034)

@Stevenjoelrs Stevenjoelrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests 2 y 3 tienen await new Promise(r => setTimeout(r, 10_100)) para esperar que pase la ventana de rate limiting (10s) esta bien pero alarga los tests a ~15-30s.
Si en el futuro se cambia RATE_LIMIT_MS, estos tests se rompen silenciosamente. Consideraría exportar la constante o mockearla

Comment thread tests/integration/submissions.test.ts Outdated

}, 30000);

});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

se cierra prematuramente el describe, los últimos 3 tests quedaron huérfanos, funciona pero la estructura está mal

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elimina los console.logs

Comment thread tests/integration/submissions.test.ts Outdated
}),
headers: {
"Content-Type": "application/json",
"x-forwarded-for": team.id,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en las lineas 153, 243, 441 esta puesto "x-forwarded-for": team.id. El endpoint de submissions no usa la IP para nada (el rate limit es por userId)

Comment thread tests/integration/submissions.test.ts Outdated



it("flag incorrecta: creates failed submission without score", async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"flag incorrecta" tas mezclando español/inglés xd

@Stevenjoelrs Stevenjoelrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants