Skip to content

Kyle: Implement Security and Validation "Sad Path" Integration Tests #7

@kn-dev-code

Description

@kn-dev-code
Image

cd backend npm install -D vitest supertest

Please add this test script to your package.json:
Image

Pressure-test the backend to ensure the API is secure and resilient against invalid data or unauthorized access.

Specific Test Cases:

Privacy Check: Verify that User A cannot GET, PATCH, or DELETE a task belonging to User B (expect 404 Not Found or 403 Forbidden).

Validation Check: Ensure the API rejects requests missing a title or using an invalid status enum (expect 400 Bad Request).

Auth Guard: Confirm that requests without a valid authCookie are rejected (expect 401 Unauthorized).

Cleanup Verification: Prove that the DELETE endpoint actually removes the record from MongoDB by checking the database directly in the test.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions