Skip to content

Commit 4f7e973

Browse files
committed
Support tag filtering in processes endpoint
1 parent c616334 commit 4f7e973

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

src/api/yepcodeApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ export class YepCodeApi {
364364
async getProcesses(
365365
params: {
366366
keywords?: string;
367+
tags?: string[];
367368
page?: number;
368369
limit?: number;
369370
} = {}

tests/api/yepcodeApi.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { YepCodeApi } from "../../src/api/yepcodeApi";
2+
import { ProcessesPaginatedResult } from "../../src/api/types";
3+
4+
const apiHost = process.env.YEPCODE_API_HOST;
5+
const apiToken = process.env.YEPCODE_API_TOKEN;
6+
7+
let api: YepCodeApi;
8+
9+
describe("YepCodeApi", () => {
10+
beforeAll(async () => {
11+
api = new YepCodeApi({ apiHost, apiToken });
12+
});
13+
14+
describe("processes", () => {
15+
it("should return a paginated list of processes", async () => {
16+
const result: ProcessesPaginatedResult = await api.getProcesses();
17+
18+
expect(result).toHaveProperty("hasNextPage");
19+
expect(result).toHaveProperty("page");
20+
expect(result).toHaveProperty("limit");
21+
expect(result).toHaveProperty("total");
22+
expect(result).toHaveProperty("data");
23+
expect(Array.isArray(result.data)).toBe(true);
24+
});
25+
26+
it("should return a paginated list of processes with a tag", async () => {
27+
const result: ProcessesPaginatedResult = await api.getProcesses({
28+
tags: ["yc-run"],
29+
});
30+
31+
expect(result).toHaveProperty("hasNextPage");
32+
expect(result).toHaveProperty("page");
33+
expect(result).toHaveProperty("limit");
34+
expect(result).toHaveProperty("total");
35+
expect(result).toHaveProperty("data");
36+
expect(Array.isArray(result.data)).toBe(true);
37+
});
38+
});
39+
});

0 commit comments

Comments
 (0)