Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit a885b8a

Browse files
committed
Minor improvements and fixes.
1 parent c88c8bc commit a885b8a

File tree

5 files changed

+75
-49
lines changed

5 files changed

+75
-49
lines changed

tests/api/features/alias.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ const componentCpeAliases = [];
2828

2929
test("Alias / Get aliases by pURL", async ({ axios }) => {
3030
var urlEncodedPurl = encodeURIComponent(
31-
"pkg:rpm/redhat/openssl@3.0.7-18.el9_2?arch=src"
31+
opensslPurl[0]
3232
);
3333

34-
const vanillaResponse = await axios.get(
34+
const response = await axios.get(
3535
`/api/v2/analysis/component/${urlEncodedPurl}`
3636
);
3737

38-
expect(vanillaResponse.data.items).toEqual(
38+
expect(response.data.items).toEqual(
3939
expect.arrayContaining([
4040
expect.objectContaining({
4141
purl: expect.arrayContaining(opensslPurl.concat(opensslPurlAliases)),
@@ -46,14 +46,14 @@ test("Alias / Get aliases by pURL", async ({ axios }) => {
4646

4747
test("Alias / Get aliases by pURL alias", async ({ axios }) => {
4848
var urlEncodedPurlAlias = encodeURIComponent(
49-
"pkg:rpm/redhat/openssl@3.0.7-18.el9_2?arch=src&repository_id=rhel-9-for-aarch64-baseos-aus-source-rpms"
49+
opensslPurlAliases[0]
5050
);
5151

52-
const vanillaResponse = await axios.get(
52+
const response = await axios.get(
5353
`/api/v2/analysis/component/${urlEncodedPurlAlias}`
5454
);
5555

56-
expect(vanillaResponse.data.items).toEqual(
56+
expect(response.data.items).toEqual(
5757
expect.arrayContaining([
5858
expect.objectContaining({
5959
purl: expect.arrayContaining(opensslPurl.concat(opensslPurlAliases)),
@@ -66,11 +66,11 @@ test("Alias / Get aliases by CPE", async ({ axios }) => {
6666
// We currently don't have a suitable SBOM for this. At most we can verify that the CPE field is an array, which wasn't the case before this feature was implemented.
6767
var urlEncodedCpe = encodeURIComponent("cpe:/a:redhat:quarkus:2.13::el8");
6868

69-
const vanillaResponse = await axios.get(
69+
const response = await axios.get(
7070
`/api/v2/analysis/component/${urlEncodedCpe}`
7171
);
7272

73-
expect(vanillaResponse.data.items).toEqual(
73+
expect(response.data.items).toEqual(
7474
expect.arrayContaining([
7575
expect.objectContaining({
7676
cpe: expect.arrayContaining(componentCpe.concat(componentCpeAliases)),
@@ -81,10 +81,10 @@ test("Alias / Get aliases by CPE", async ({ axios }) => {
8181

8282
test.skip("Alias / Get aliases by CPE alias", async ({ axios }) => {});
8383

84-
test("Alias / Get aliases by query", async ({ axios }) => {
85-
const vanillaResponse = await axios.get(`/api/v2/analysis/component?q=rhel`);
84+
test.skip("Alias / Get aliases by query", async ({ axios }) => {
85+
const response = await axios.get(`/api/v2/analysis/component?q=rhel`);
8686

87-
expect(vanillaResponse.data.items).toEqual(
87+
expect(response.data.items).toEqual(
8888
expect.arrayContaining([
8989
expect.objectContaining({
9090
purl: expect.arrayContaining(opensslPurlAliases),

tests/api/features/relationship-ancestor-of.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ test("Ancestor of / CDX / Upstream component has descendants that include downst
1616
}) => {
1717
const urlEncodedUpstreamPurl = encodeURIComponent(cdxUpstreamPurl);
1818

19-
const vanillaResponse = await axios.get(
19+
const response = await axios.get(
2020
`/api/v2/analysis/component/${urlEncodedUpstreamPurl}?descendants=10`
2121
);
2222

23-
expect(vanillaResponse.data.items).toEqual(
23+
expect(response.data.items).toEqual(
2424
expect.arrayContaining([
2525
expect.objectContaining({
2626
purl: expect.arrayContaining([cdxUpstreamPurl]),
@@ -39,11 +39,11 @@ test("Ancestor of / CDX / Upstream component has descendants that include downst
3939
test.skip("Ancestor of / CDX / Upstream component has descendants that include downstream component / Get with query", async ({
4040
axios,
4141
}) => {
42-
const vanillaResponse = await axios.get(
42+
const response = await axios.get(
4343
`/api/v2/analysis/component?q=${query}?descendants=10`
4444
);
4545

46-
expect(vanillaResponse.data.items).toEqual(
46+
expect(response.data.items).toEqual(
4747
expect.arrayContaining([
4848
expect.objectContaining({
4949
purl: expect.arrayContaining([cdxUpstreamPurl]),
@@ -63,11 +63,11 @@ test("Ancestor of / CDX / Downstream component has ancestors that include upstre
6363
}) => {
6464
const urlEncodedDownstreamPurl = encodeURIComponent(cdxDownstreamPurl);
6565

66-
const vanillaResponse = await axios.get(
66+
const response = await axios.get(
6767
`/api/v2/analysis/component/${urlEncodedDownstreamPurl}?ancestors=10`
6868
);
6969

70-
expect(vanillaResponse.data.items).toEqual(
70+
expect(response.data.items).toEqual(
7171
expect.arrayContaining([
7272
expect.objectContaining({
7373
purl: expect.arrayContaining([cdxDownstreamPurl]),
@@ -86,11 +86,11 @@ test("Ancestor of / CDX / Downstream component has ancestors that include upstre
8686
test.skip("Ancestor of / CDX / Downstream component has ancestors that include upstream component / Get with query", async ({
8787
axios,
8888
}) => {
89-
const vanillaResponse = await axios.get(
89+
const response = await axios.get(
9090
`/api/v2/analysis/component?q=${query}?descendants=10`
9191
);
9292

93-
expect(vanillaResponse.data.items).toEqual(
93+
expect(response.data.items).toEqual(
9494
expect.arrayContaining([
9595
expect.objectContaining({
9696
purl: expect.arrayContaining([cdxDownstreamPurl]),
@@ -110,11 +110,11 @@ test("Ancestor of / SPDX / Upstream component has descendants that include downs
110110
}) => {
111111
const urlEncodedUpstreamPurl = encodeURIComponent(spdxUpstreamPurl);
112112

113-
const vanillaResponse = await axios.get(
113+
const response = await axios.get(
114114
`/api/v2/analysis/component/${urlEncodedUpstreamPurl}?descendants=10`
115115
);
116116

117-
expect(vanillaResponse.data.items).toEqual(
117+
expect(response.data.items).toEqual(
118118
expect.arrayContaining([
119119
expect.objectContaining({
120120
purl: expect.arrayContaining([spdxUpstreamPurl]),
@@ -133,11 +133,11 @@ test("Ancestor of / SPDX / Upstream component has descendants that include downs
133133
test.skip("Ancestor of / SPDX / Upstream component has descendants that include downstream component / Get with query", async ({
134134
axios,
135135
}) => {
136-
const vanillaResponse = await axios.get(
136+
const response = await axios.get(
137137
`/api/v2/analysis/component?q=${query}?descendants=10`
138138
);
139139

140-
expect(vanillaResponse.data.items).toEqual(
140+
expect(response.data.items).toEqual(
141141
expect.arrayContaining([
142142
expect.objectContaining({
143143
purl: expect.arrayContaining([spdxUpstreamPurl]),
@@ -157,11 +157,11 @@ test("Ancestor of / SPDX / Downstream component has ancestors that include upstr
157157
}) => {
158158
const urlEncodedDownstreamPurl = encodeURIComponent(spdxDownstreamPurl);
159159

160-
const vanillaResponse = await axios.get(
160+
const response = await axios.get(
161161
`/api/v2/analysis/component/${urlEncodedDownstreamPurl}?ancestors=10`
162162
);
163163

164-
expect(vanillaResponse.data.items).toEqual(
164+
expect(response.data.items).toEqual(
165165
expect.arrayContaining([
166166
expect.objectContaining({
167167
purl: expect.arrayContaining([spdxDownstreamPurl]),
@@ -180,11 +180,11 @@ test("Ancestor of / SPDX / Downstream component has ancestors that include upstr
180180
test.skip("Ancestor of / SPDX / Downstream component has ancestors that include upstream component / Get with query", async ({
181181
axios,
182182
}) => {
183-
const vanillaResponse = await axios.get(
183+
const response = await axios.get(
184184
`/api/v2/analysis/component?q=${query}?descendants=10`
185185
);
186186

187-
expect(vanillaResponse.data.items).toEqual(
187+
expect(response.data.items).toEqual(
188188
expect.arrayContaining([
189189
expect.objectContaining({
190190
purl: expect.arrayContaining([spdxDownstreamPurl]),

tests/api/features/relationship-generated-from.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ test("Generated from / CDX / Source has descendants that include binaries / Get
1616
}) => {
1717
const urlEncodedSourcePurl = encodeURIComponent(cdxSourcePurl);
1818

19-
const vanillaResponse = await axios.get(
19+
const response = await axios.get(
2020
`/api/v2/analysis/component/${urlEncodedSourcePurl}?descendants=10`
2121
);
2222

23-
expect(vanillaResponse.data.items).toEqual(
23+
expect(response.data.items).toEqual(
2424
expect.arrayContaining([
2525
expect.objectContaining({
2626
purl: expect.arrayContaining([cdxSourcePurl]),
@@ -41,11 +41,11 @@ test("Generated from / CDX / Binary has ancestors that include the source / Get
4141
}) => {
4242
const urlEncodedBinaryPurl = encodeURIComponent(cdxBinaryPurl);
4343

44-
const vanillaResponse = await axios.get(
44+
const response = await axios.get(
4545
`/api/v2/analysis/component/${urlEncodedBinaryPurl}?ancestors=10`
4646
);
4747

48-
expect(vanillaResponse.data.items).toEqual(
48+
expect(response.data.items).toEqual(
4949
expect.arrayContaining([
5050
expect.objectContaining({
5151
purl: expect.arrayContaining([cdxBinaryPurl]),
@@ -66,11 +66,11 @@ test("Generated from / SPDX / Source has descendants that include binaries / Get
6666
}) => {
6767
const urlEncodedSourcePurl = encodeURIComponent(spdxSourcePurl);
6868

69-
const vanillaResponse = await axios.get(
69+
const response = await axios.get(
7070
`/api/v2/analysis/component/${urlEncodedSourcePurl}?descendants=10`
7171
);
7272

73-
expect(vanillaResponse.data.items).toEqual(
73+
expect(response.data.items).toEqual(
7474
expect.arrayContaining([
7575
expect.objectContaining({
7676
purl: expect.arrayContaining([spdxSourcePurl]),
@@ -91,11 +91,11 @@ test("Generated from / SPDX / Binary has ancestors that include the source / Get
9191
}) => {
9292
const urlEncodedBinaryPurl = encodeURIComponent(spdxBinaryPurl);
9393

94-
const vanillaResponse = await axios.get(
94+
const response = await axios.get(
9595
`/api/v2/analysis/component/${urlEncodedBinaryPurl}?ancestors=10`
9696
);
9797

98-
expect(vanillaResponse.data.items).toEqual(
98+
expect(response.data.items).toEqual(
9999
expect.arrayContaining([
100100
expect.objectContaining({
101101
purl: expect.arrayContaining([spdxBinaryPurl]),

tests/api/features/relationship-package-of.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@ const spdxComponentPurl =
1515
// const spdxDocumentId = "https://www.redhat.com/rhel-9.2-eus.spdx.json";
1616

1717
// Effectively tests TC-2048 / TC-2049 - Denote relationship between Product SBOM and other SBOM.
18+
test.skip("Product-Component / CDX / Product SBOM provides information from component SBOM / Get with pURL", async ({ axios }) => {
19+
});
20+
test.skip("Product-Component / CDX / Component SBOM provides information from product SBOM / Get with pURL", async ({ axios }) => {
21+
});
22+
1823
test("Product-Component / CDX / Product SBOM provides information from component SBOM / Get with CPE", async ({
1924
axios,
2025
}) => {
2126
const urlEncodedProductCpe = encodeURIComponent(cdxProductCpeNoSpecialChars);
2227

23-
const vanillaResponse = await axios.get(
28+
const response = await axios.get(
2429
`/api/v2/analysis/component/${urlEncodedProductCpe}?descendants=10`
2530
);
2631

27-
expect(vanillaResponse.data.items).toEqual(
32+
expect(response.data.items).toEqual(
2833
expect.arrayContaining([
2934
expect.objectContaining({
3035
cpe: expect.arrayContaining([cdxProductCpe]),
@@ -45,16 +50,28 @@ test("Product-Component / CDX / Product SBOM provides information from component
4550
);
4651
});
4752

53+
test.skip("Product-Component / CDX / Component SBOM provides information from product SBOM / Get with CPE", async ({ axios }) => {
54+
});
55+
56+
test.skip("Product-Component / CDX / Product SBOM provides information from product SBOM / Get with query", async ({ axios }) => {
57+
});
58+
59+
test.skip("Product-Component / CDX / Component SBOM provides information from product SBOM / Get with query", async ({ axios }) => {
60+
});
61+
62+
test.skip("Product-Component / SPDX / Product SBOM provides information from component SBOM / Get with pURL", async ({ axios }) => {
63+
});
64+
4865
test("Product-Component / SPDX / Product SBOM provides information from component SBOM / Get with CPE", async ({
4966
axios,
5067
}) => {
5168
const urlEncodedProductCpe = encodeURIComponent(spdxProductCpeNoSpecialChars);
5269

53-
const vanillaResponse = await axios.get(
70+
const response = await axios.get(
5471
`/api/v2/analysis/component/${urlEncodedProductCpe}?descendants=10`
5572
);
5673

57-
expect(vanillaResponse.data.items).toEqual(
74+
expect(response.data.items).toEqual(
5875
expect.arrayContaining([
5976
expect.objectContaining({
6077
cpe: expect.arrayContaining([spdxProductCpe]),
@@ -75,11 +92,11 @@ test.skip("Product-Component / SPDX / Component SBOM provides information from p
7592
}) => {
7693
const urlEncodedComponentPurl = encodeURIComponent(spdxComponentPurl);
7794

78-
const vanillaResponse = await axios.get(
95+
const response = await axios.get(
7996
`/api/v2/analysis/component/${urlEncodedComponentPurl}?ancestors=10`
8097
);
8198

82-
expect(vanillaResponse.data.items).toEqual(
99+
expect(response.data.items).toEqual(
83100
expect.arrayContaining([
84101
expect.objectContaining({
85102
purl: expect.arrayContaining([spdxComponentPurl]),
@@ -94,3 +111,12 @@ test.skip("Product-Component / SPDX / Component SBOM provides information from p
94111
])
95112
);
96113
});
114+
115+
test.skip("Product-Component / SPDX / Component SBOM provides information from product SBOM / Get with CPE", async ({ axios }) => {
116+
});
117+
118+
test.skip("Product-Component / SPDX / Product SBOM provides information from product SBOM / Get with query", async ({ axios }) => {
119+
});
120+
121+
test.skip("Product-Component / SPDX / Component SBOM provides information from product SBOM / Get with query", async ({ axios }) => {
122+
});

tests/api/features/relationship-variant-of.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ test("Variant of / CDX / Binary image has ancestors that include index image / G
1717
}) => {
1818
const urlEncodedBinaryImagePurl = encodeURIComponent(cdxBinaryImagePurl);
1919

20-
const vanillaResponse = await axios.get(
20+
const response = await axios.get(
2121
`/api/v2/analysis/component/${urlEncodedBinaryImagePurl}?ancestors=10`
2222
);
2323

24-
expect(vanillaResponse.data.items).toEqual(
24+
expect(response.data.items).toEqual(
2525
expect.arrayContaining([
2626
expect.objectContaining({
2727
purl: expect.arrayContaining([cdxBinaryImagePurl]),
@@ -41,11 +41,11 @@ test("Variant of / CDX / Index image has descendants that include binary image /
4141
}) => {
4242
const urlEncodedIndexImagePurl = encodeURIComponent(cdxIndexImagePurl);
4343

44-
const vanillaResponse = await axios.get(
44+
const response = await axios.get(
4545
`/api/v2/analysis/component/${urlEncodedIndexImagePurl}?descendants=10`
4646
);
4747

48-
expect(vanillaResponse.data.items).toEqual(
48+
expect(response.data.items).toEqual(
4949
expect.arrayContaining([
5050
expect.objectContaining({
5151
purl: expect.arrayContaining([cdxIndexImagePurl]),
@@ -65,11 +65,11 @@ test("Variant of / SPDX / Binary image has ancestors that include index image /
6565
}) => {
6666
const urlEncodedBinaryImagePurl = encodeURIComponent(spdxBinaryImagePurl);
6767

68-
const vanillaResponse = await axios.get(
68+
const response = await axios.get(
6969
`/api/v2/analysis/component/${urlEncodedBinaryImagePurl}?ancestors=10`
7070
);
7171

72-
expect(vanillaResponse.data.items).toEqual(
72+
expect(response.data.items).toEqual(
7373
expect.arrayContaining([
7474
expect.objectContaining({
7575
purl: expect.arrayContaining([spdxBinaryImagePurl]),
@@ -89,11 +89,11 @@ test("Variant of / SPDX / Index image has descendants that include binary image
8989
}) => {
9090
const urlEncodedIndexImagePurl = encodeURIComponent(spdxIndexImagePurl);
9191

92-
const vanillaResponse = await axios.get(
92+
const response = await axios.get(
9393
`/api/v2/analysis/component/${urlEncodedIndexImagePurl}?descendants=10`
9494
);
9595

96-
expect(vanillaResponse.data.items).toEqual(
96+
expect(response.data.items).toEqual(
9797
expect.arrayContaining([
9898
expect.objectContaining({
9999
purl: expect.arrayContaining([spdxIndexImagePurl]),

0 commit comments

Comments
 (0)