ljmotta commented on code in PR #3403:
URL:
https://github.com/apache/incubator-kie-tools/pull/3403#discussion_r2761446022
##########
packages/k8s-yaml-to-apiserver-requests/tests/jsonPatch/patchK8sResourceYaml.test.ts:
##########
Review Comment:
Please consider inlining the test case values or creating a test table with
clear given / expected fields. The current structure makes it difficult to
visualize the different test scenarios.
Test table example (property names are just a suggestion):
```ts
[{
name: "should add a label to existing labels",
given: {
yaml: `
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 1`,
patch: [{
op: "add",
path: "/metadata/labels/environment",
value: "production",
}]
},
expected: "environment: production"
},
// ...
]
```
Alternatively, inlining the values directly in the test cases would also be
fine, even if it means duplicating some content between tests:
```ts
it("should add a label to existing labels", () => {
const result = patchK8sResourceYaml(`
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 1`, [{
jsonPatches: [{
op: "add",
path: "/metadata/labels/environment",
value: "production",
}]}]);
expect(result).toContain("environment: production");
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]