Add authorization-boundary, integration and component tests
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- HTML
- Stars
- 10
- Forks
- 0
- Avg merge
- 2h 52m
- Merged PRs (30d)
- 20
Description
Tier 3 — testing
Problem
There are 38 tests, all in LearnStack.Core.Tests, all covering service-level happy paths against SQLite. Nothing covers the parts most likely to cause a production incident:
- Authorization boundaries — can user A read, update or delete user B's resources, ideas or groups? The services take
userIdas a parameter and every caller must pass the right one; that contract is untested. - The share-token flow and the anonymous
/shared/{token}page - The friend invitation accept flow (expiry, self-accept, double-accept)
- Any Blazor component (no bUnit)
- No coverage threshold, and
coverlet.collectoris referenced but not enforced
Evidence
LearnStack.Core.Tests/—UrlNormalizerTests(6),ContentIdeaServiceTests(19),LearningResourceServiceTests(12),OpenGraphServiceTests(7)LearnStack.Core.Tests/LearnStack.Core.Tests.csproj:9— coverlet present, unused
Proposed fix
- Add a cross-user authorization test per service method.
- Add a
WebApplicationFactoryintegration test project covering register → login → create → share → anonymous view, and the friend-invitation edge cases. - Add bUnit tests for
ResourceForm,ResourceCardand the Pulse components. - Enforce a coverage floor in CI.
Acceptance criteria
- Every service method has a "wrong user" test
- Auth and sharing flows covered end to end
- Coverage reported in CI and enforced
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in LearnStack.Core.Tests and read the existing service tests, then inspect LearnStack.Core.Tests/LearnStack.Core.Tests.csproj:9 and the named flows and components. The work is complete when wrong-user cases, end-to-end auth and sharing flows, component tests, and enforced CI coverage meet the listed acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sqlite
- Domain
- authentication, authorization, ci-cd, frontend, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100