Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/models/WorkItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export type WorkItemExpandableFieldName = keyof WorkItemExpandableFields;
export type WorkItem<Expanded extends WorkItemExpandableFieldName = never> = [Expanded] extends [never]
? WorkItemBase
: Omit<WorkItemBase, Expanded> & {
[K in Expanded]: K extends keyof WorkItemExpandableFields ? WorkItemExpandableFields[K] : never;
};
[K in Expanded]: K extends keyof WorkItemExpandableFields ? WorkItemExpandableFields[K] : never;
};
Comment thread
sangeethailango marked this conversation as resolved.
Outdated

export interface CreateWorkItem {
name: string;
Expand Down Expand Up @@ -87,6 +87,7 @@ export interface ListWorkItemsParams {
assignee?: string;
limit?: number;
offset?: number;
pql?: string;
}

export interface WorkItemActivity {
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/work-items/work-items.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ describe(!!(config.workspaceSlug && config.projectId && config.userId), "Work It
expect(foundWorkItem).toBeDefined();
});

it("should list work items with pql filter", async () => {
const allWorkItems = await client.workItems.list(workspaceSlug, projectId);
const priority = allWorkItems.results[0]?.priority ?? "none";

const filtered = await client.workItems.list(workspaceSlug, projectId, {
pql: `priority IN ("${priority}")`,
});
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test can produce false positives: if the first listed work item has no priority (or a value not supported by PQL), the fallback to "none" can yield an empty filtered result set, and the assertions still pass because the loop doesn’t run. Consider making the test deterministic by setting a known priority on the created workItem (or selecting a work item with a defined priority) and building the PQL from that known value.

Copilot uses AI. Check for mistakes.

expect(filtered).toBeDefined();
expect(Array.isArray(filtered.results)).toBe(true);
Comment thread
sangeethailango marked this conversation as resolved.
Outdated
for (const wi of filtered.results) {
expect(wi.priority).toBe(priority);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
});

it("should retrieve work item by identifier", async () => {
const project = await client.projects.retrieve(workspaceSlug, projectId);
const workItemByIdentifier = await client.workItems.retrieveByIdentifier(
Expand Down
Loading