add unit test coverage for HeaderField
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Task Summary
Add a dedicated unit-spec (`HeaderFieldSpec.scala`) that pins the value, format, and distinctness of every HTTP header-name constant defined in `auth/util/HeaderField`. The spec catches accidental renames that would silently break header-based authentication.
## Background
`HeaderField` in `common/auth` (`auth/util/HeaderField.scala`) currently lacks a dedicated unit-spec. It is a small `object` that holds the canonical HTTP header names the auth layer reads from every request — drift in any constant silently breaks header-based authentication.
```scala
object HeaderField {
val UserComputingUnitAccess = "x-user-computing-unit-access"
val UserId = "x-user-id"
val UserName = "x-user-name"
val UserEmail = "x-user-email"
}
```
## Behavior to pin
| Surface | Contract |
| --- | --- |
| `UserComputingUnitAccess` | equals `"x-user-computing-unit-access"` |
| `UserId` | equals `"x-user-id"` |
| `UserName` | equals `"x-user-name"` |
| `UserEmail` | equals `"x-user-email"` |
| Header-name format | every constant matches the `x-user-*` namespace and uses lowercase + hyphen-separated (RFC-7230 compatible) |
| Distinctness | every constant has a distinct value (no accidental aliasing under refactor) |
## Scope
- New spec file: `HeaderFieldSpec.scala` (matches the `Spec.scala` convention).
- No production-code changes.
- This is a very small spec (~50 lines) — the value is regression coverage against accidental renames, not coverage of complex logic.
## Notes
`common/auth` already has ScalaTest as a `% Test` dependency, so no build changes are needed.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
Contributor guide
Assessment
This issue has not been assessed yet.