Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add authorization-boundary, integration and component tests

未关闭
#60 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp, sqlite

调研方向

从 LearnStack.Core.Tests 开始,阅读现有的服务测试,然后检查 LearnStack.Core.Tests/LearnStack.Core.Tests.csproj:9 以及列出的流程和组件。当错误用户案例、端到端身份验证和共享流程、组件测试以及 CI 中强制执行的覆盖率满足所列验收标准时,工作即告完成。

由索引模型根据 Issue 内容生成。

描述

enhancement

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 userId as 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.collector is 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
  1. Add a cross-user authorization test per service method.
  2. Add a WebApplicationFactory integration test project covering register → login → create → share → anonymous view, and the friend-invitation edge cases.
  3. Add bUnit tests for ResourceForm, ResourceCard and the Pulse components.
  4. 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
主要语言
HTML
星标
10
派生
0
平均合并
2 小时 35 分钟
30 天内合并 PR
21

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

kasuken/LearnStack 的其他 Issue

查看 kasuken/LearnStack 的全部 Issue

相似的 Issue

更多 Security Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。