Skip to content

Commit

Permalink
feat: add ChecksAll
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta authored and hacdias committed Jul 26, 2023
1 parent eff3fcb commit cb7fa3d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- `--verbose` flag displays all the output to the console
- `Expect.Headers.ChecksAll`: an expectation to test all the header values (0, 1, or more)

### Changed
- finalized port of Kubo's sharness tests. [PR](https://github.com/ipfs/gateway-conformance/pull/92)
Expand Down
6 changes: 4 additions & 2 deletions tests/path_gateway_raw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ func TestGatewayBlockMultiRangeRequest(t *testing.T) {
return v != ""
}),
Header("Content-Range").
Checks(func(v string) bool {
contentRange = v
ChecksAll(func(v []string) bool {
if len(v) == 1 {
contentRange = v[0]
}
return true
}),
),
Expand Down
7 changes: 7 additions & 0 deletions tooling/test/sugar.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ func (h HeaderBuilder) Checks(f func(string) bool) HeaderBuilder {
return h
}

func (h HeaderBuilder) ChecksAll(f func([]string) bool) HeaderBuilder {
h.Check_ = check.CheckFunc[[]string]{
Fn: f,
}
return h

Check warning on line 274 in tooling/test/sugar.go

View check run for this annotation

Codecov / codecov/patch

tooling/test/sugar.go#L270-L274

Added lines #L270 - L274 were not covered by tests
}

func (h HeaderBuilder) Not() HeaderBuilder {
h.Not_ = !h.Not_
return h
Expand Down

0 comments on commit cb7fa3d

Please sign in to comment.