From 664afa4bec0ac652f95b3414ded5d253d70c6a72 Mon Sep 17 00:00:00 2001 From: kriptoburak Date: Thu, 2 Jul 2026 19:43:46 +0300 Subject: [PATCH] test: cover Xquik service extraction --- tests/service.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/service.test.ts b/tests/service.test.ts index a393783..6e7c536 100644 --- a/tests/service.test.ts +++ b/tests/service.test.ts @@ -99,6 +99,23 @@ describe(fileName, () => { expect(methods[0].method.getName()).toBe("foo"); }); + test("getMethodsFromService - extracts Xquik search endpoint", () => { + const source = ` + export const searchTweets = (options?: Options) => + (options?.client ?? client).get({ + url: '/api/v1/x/tweets/search', + query: { q: 'openapi', queryType: 'Latest', limit: 20 }, + headers: { 'x-api-key': 'test-key' }, + }); + `; + const project = new Project(); + const sourceFile = project.createSourceFile("test.ts", source); + const methods = getMethodsFromService(sourceFile); + expect(methods).toHaveLength(1); + expect(methods[0].method.getName()).toBe("searchTweets"); + expect(methods[0].httpMethodName).toBe("get"); + }); + test("getMethodsFromService - extracts JSDoc comment", () => { const source = ` /** This is a description */