Skip to content

Commit f0ae9c3

Browse files
apply gemini feedback
1 parent 2b31a38 commit f0ae9c3

File tree

2 files changed

+35
-50
lines changed

2 files changed

+35
-50
lines changed

__tests__/BuckslipsApi.spec.ts

Lines changed: 25 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -51,41 +51,29 @@ describe("BuckSlipsApi", () => {
5151
it("creates, updates, and gets a buckslip", async () => {
5252
const buckslipsApi = new BuckslipsApi(CONFIG_FOR_INTEGRATION);
5353

54-
try {
55-
// Create buckslip with proper file references
56-
const createdBe = await buckslipsApi.create(createBe);
57-
expect(createdBe.id).toBeDefined();
58-
expect(createdBe.description).toEqual(createBe.description);
54+
// Create buckslip with proper file references
55+
const createdBe = await buckslipsApi.create(createBe);
56+
expect(createdBe.id).toBeDefined();
57+
expect(createdBe.description).toEqual(createBe.description);
5958

60-
// Get
61-
const retrievedBe = await buckslipsApi.get(createdBe.id as string);
62-
expect(retrievedBe).toEqual(
63-
expect.objectContaining({
64-
id: createdBe.id,
65-
})
66-
);
59+
// Get
60+
const retrievedBe = await buckslipsApi.get(createdBe.id as string);
61+
expect(retrievedBe).toEqual(
62+
expect.objectContaining({
63+
id: createdBe.id,
64+
})
65+
);
6766

68-
// Update
69-
const updates = new BuckslipEditable({
70-
description: "updated buckslip",
71-
});
72-
const updatedBe = await buckslipsApi.update(
73-
retrievedBe.id as string,
74-
updates
75-
);
76-
expect(updatedBe).toBeDefined();
77-
expect(updatedBe.description).toEqual("updated buckslip");
78-
} catch (error) {
79-
// If creation fails due to API requirements, just test the API structure
80-
expect(buckslipsApi).toEqual(
81-
expect.objectContaining({
82-
create: expect.any(Function),
83-
get: expect.any(Function),
84-
update: expect.any(Function),
85-
delete: expect.any(Function),
86-
})
87-
);
88-
}
67+
// Update
68+
const updates = new BuckslipEditable({
69+
description: "updated buckslip",
70+
});
71+
const updatedBe = await buckslipsApi.update(
72+
retrievedBe.id as string,
73+
updates
74+
);
75+
expect(updatedBe).toBeDefined();
76+
expect(updatedBe.description).toEqual("updated buckslip");
8977
});
9078
});
9179

@@ -100,20 +88,10 @@ describe("BuckSlipsApi", () => {
10088
});
10189

10290
it("lists buckslips", async () => {
103-
try {
104-
const response = await new BuckslipsApi(CONFIG_FOR_INTEGRATION).List();
105-
expect(response.data).toBeDefined();
106-
// Don't require data to exist, just verify the API works
107-
expect(Array.isArray(response.data)).toBeTruthy();
108-
} catch (error) {
109-
// If listing fails due to API requirements in CI, just verify the API structure exists
110-
const buckslipsApi = new BuckslipsApi(CONFIG_FOR_INTEGRATION);
111-
expect(buckslipsApi).toEqual(
112-
expect.objectContaining({
113-
List: expect.any(Function),
114-
})
115-
);
116-
}
91+
const response = await new BuckslipsApi(CONFIG_FOR_INTEGRATION).List();
92+
expect(response.data).toBeDefined();
93+
// Don't require data to exist, just verify the API works
94+
expect(Array.isArray(response.data)).toBeTruthy();
11795
});
11896
});
11997
});

api/buckslips-api.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export const BuckslipsApiAxiosParamCreator = function (
7575
): Promise<RequestArgs> => {
7676
// verify required parameter 'buckslipEditable' is not null or undefined
7777
assertParamExists("buckslipCreate", "buckslipEditable", buckslipEditable);
78-
const mpHeaders = options.data ? options.data.getHeaders() : {};
7978
const localVarPath = `/buckslips`;
8079
// use dummy base URL string because the URL constructor only accepts absolute URLs.
8180
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@@ -99,10 +98,18 @@ export const BuckslipsApiAxiosParamCreator = function (
9998
localVarHeaderParameter["Content-Type"] = "application/json";
10099

101100
setSearchParams(localVarUrlObj, localVarQueryParameter);
101+
let headersFromBaseOptions =
102+
baseOptions && baseOptions.headers ? baseOptions.headers : {};
102103
localVarRequestOptions.headers = {
103-
...mpHeaders,
104+
...localVarHeaderParameter,
105+
...headersFromBaseOptions,
106+
...options.headers,
104107
};
105-
localVarRequestOptions.data = options.data;
108+
localVarRequestOptions.data = serializeDataIfNeeded(
109+
buckslipEditable,
110+
localVarRequestOptions,
111+
configuration
112+
);
106113

107114
return {
108115
url: toPathString(localVarUrlObj),

0 commit comments

Comments
 (0)