Skip to content

Commit 1f8a40e

Browse files
fix tests
1 parent 582f296 commit 1f8a40e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/getData.spec.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ test.describe("oc-client : getData", () => {
131131
if (bodyData instanceof URLSearchParams) {
132132
// Handle URL-encoded body
133133
const componentsParam = JSON.parse(bodyData.get("components"));
134-
expect(componentsParam[0].name).toEqual("myComponent");
135-
expect(componentsParam[0].version).toEqual("6.6.6");
136-
expect(componentsParam[0].parameters.name).toEqual("evil");
134+
expect(bodyData.get("components[0][name]")).toEqual("myComponent");
135+
expect(bodyData.get("components[0][version]")).toEqual("6.6.6");
136+
expect(bodyData.get("components[0][parameters][name]")).toEqual("evil");
137137
} else {
138138
// Handle JSON body
139139
expect(bodyData.components[0].name).toEqual("myComponent");
@@ -336,7 +336,10 @@ test.describe("oc-client : getData", () => {
336336
} else {
337337
// Create a simple parser for url-encoded data
338338
const params = new URLSearchParams(options.body);
339-
bodyData = { components: JSON.parse(params.get("components")) };
339+
const name = params.get("components[0][parameters][name]");
340+
const test = params.get("components[0][parameters][test]");
341+
342+
bodyData = { components: [{ parameters: { name, test } }] };
340343
}
341344

342345
requestData = {

0 commit comments

Comments
 (0)