Skip to content

Commit

Permalink
fix test (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuven Harrison authored Dec 8, 2023
1 parent 92576d1 commit d5b73fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions BREAKING-CHANGES-EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ These examples are automatically generated from unit tests.
[deleting a media-type from response is breaking](checker/checker_breaking_test.go?plain=1#L448)
[deleting a non-required non-write-only property in response body is breaking with warning](checker/checker_breaking_property_test.go?plain=1#L511)
[deleting a path is breaking](checker/checker_breaking_test.go?plain=1#L43)
[deleting a path with some operations having sunset date in the future is breaking](checker/checker_deprecation_test.go?plain=1#L280)
[deleting a path with some operations having sunset date in the future is breaking](checker/checker_deprecation_test.go?plain=1#L281)
[deleting a required property in request is breaking with warn](checker/checker_breaking_property_test.go?plain=1#L368)
[deleting a required property in response body is breaking](checker/checker_breaking_property_test.go?plain=1#L420)
[deleting a required property under AllOf in response body is breaking](checker/checker_breaking_property_test.go?plain=1#L450)
Expand All @@ -49,7 +49,7 @@ These examples are automatically generated from unit tests.
[deleting an operation before sunset date is breaking](checker/checker_deprecation_test.go?plain=1#L33)
[deleting an operation is breaking](checker/checker_breaking_test.go?plain=1#L51)
[deleting an operation without sunset date is breaking](checker/checker_deprecation_test.go?plain=1#L51)
[deleting sunset header for a deprecated endpoint is breaking](checker/checker_deprecation_test.go?plain=1#L298)
[deleting sunset header for a deprecated endpoint is breaking](checker/checker_deprecation_test.go?plain=1#L299)
[deprecating an operation with a deprecation policy and sunset date before required deprecation period is breaking](checker/checker_deprecation_test.go?plain=1#L223)
[deprecating an operation with a deprecation policy but without specifying sunset date is breaking](checker/checker_deprecation_test.go?plain=1#L84)
[increasing max length in response is breaking](checker/checker_breaking_min_max_test.go?plain=1#L93)
Expand Down Expand Up @@ -114,15 +114,15 @@ These examples are automatically generated from unit tests.
[changing response's body schema type from number to integer is not breaking](checker/checker_breaking_response_type_changed_test.go?plain=1#L51)
[changing response's body schema type from number/none to integer/int32 is not breaking](checker/checker_breaking_response_type_changed_test.go?plain=1#L89)
[changing servers is not breaking](checker/checker_not_breaking_test.go?plain=1#L253)
[deleting a path after sunset date of all contained operations is not breaking](checker/checker_deprecation_test.go?plain=1#L265)
[deleting a path after sunset date of all contained operations is not breaking](checker/checker_deprecation_test.go?plain=1#L266)
[deleting a pattern from a schema is not breaking](checker/checker_breaking_test.go?plain=1#L465)
[deleting a required write-only property in response body is not breaking](checker/checker_breaking_property_test.go?plain=1#L494)
[deleting a tag is not breaking](checker/checker_not_breaking_test.go?plain=1#L71)
[deleting an operation after sunset date is not breaking](checker/checker_deprecation_test.go?plain=1#L69)
[deprecating a header is not breaking](checker/checker_not_breaking_test.go?plain=1#L227)
[deprecating a parameter is not breaking](checker/checker_not_breaking_test.go?plain=1#L214)
[deprecating a schema is not breaking](checker/checker_not_breaking_test.go?plain=1#L240)
[deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking](checker/checker_deprecation_test.go?plain=1#L243)
[deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking](checker/checker_deprecation_test.go?plain=1#L244)
[deprecating an operation without a deprecation policy and without specifying sunset date is not breaking for draft level](checker/checker_deprecation_test.go?plain=1#L158)
[deprecating an operation without a deprecation policy and without specifying sunset date is not breaking](checker/checker_deprecation_test.go?plain=1#L104)
[increasing max length in request is not breaking](checker/checker_breaking_min_max_test.go?plain=1#L76)
Expand Down Expand Up @@ -270,8 +270,8 @@ These examples are automatically generated from unit tests.
[increasing request property maximum value](checker/check-request-property-max-updated_test.go?plain=1#L37)
[new header, query and cookie request params](checker/check-new-request-non-path-parameter_test.go?plain=1#L11)
[new paths or path operations](checker/check-api-added_test.go?plain=1#L11)
[path operations that became deprecated](checker/checker_deprecation_test.go?plain=1#L334)
[path operations that were re-activated](checker/checker_deprecation_test.go?plain=1#L357)
[path operations that became deprecated](checker/checker_deprecation_test.go?plain=1#L335)
[path operations that were re-activated](checker/checker_deprecation_test.go?plain=1#L358)
[removing 'allOf' subschema from the request body or request body property](checker/check-request-property-all-of-updated_test.go?plain=1#L45)
[removing 'allOf' subschema from the response body or response body property](checker/check-response-property-all-of-updated_test.go?plain=1#L45)
[removing 'anyOf' schema from the request body or request body property](checker/check-request-property-any-of-updated_test.go?plain=1#L45)
Expand Down
5 changes: 3 additions & 2 deletions checker/checker_deprecation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ func TestBreaking_DeprecationWithEarlySunset(t *testing.T) {

s2, err := open(getDeprecationFile("deprecated-future.yaml"))
require.NoError(t, err)
s2.Spec.Paths.Value("/api/test").Get.Extensions[diff.SunsetExtension] = toJson(t, civil.DateOf(time.Now()).AddDays(9).String())
sunsetDate := civil.DateOf(time.Now()).AddDays(9).String()
s2.Spec.Paths.Value("/api/test").Get.Extensions[diff.SunsetExtension] = toJson(t, sunsetDate)

d, osm, err := diff.GetWithOperationsSourcesMap(getConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -237,7 +238,7 @@ func TestBreaking_DeprecationWithEarlySunset(t *testing.T) {
require.NotEmpty(t, errs)
require.Len(t, errs, 1)
require.Equal(t, checker.APISunsetDateTooSmallId, errs[0].GetId())
require.Equal(t, "api sunset date '2023-12-16' is too small, must be at least '10' days from now", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer()))
require.Equal(t, fmt.Sprintf("api sunset date '%s' is too small, must be at least '10' days from now", sunsetDate), errs[0].GetUncolorizedText(checker.NewDefaultLocalizer()))
}

// BC: deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking
Expand Down

0 comments on commit d5b73fa

Please sign in to comment.