mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
Merge branch 'chat-project-skills/project-skills-details' into chat-project-skills/invocation-api
This commit is contained in:
@@ -21,6 +21,15 @@ const mockSkills: SkillMetadata[] = [...MockSkills, MockDisabledSkill].map(
|
||||
}),
|
||||
);
|
||||
|
||||
const mockSkillsAtCapacity: SkillMetadata[] = Array.from(
|
||||
{ length: 100 },
|
||||
(_, index) => ({
|
||||
...mockSkills[0],
|
||||
id: `skill-${index}`,
|
||||
name: `skill-${index}`,
|
||||
}),
|
||||
);
|
||||
|
||||
const mockReviewerSkill: Skill = {
|
||||
...mockSkills[0],
|
||||
content:
|
||||
@@ -64,11 +73,7 @@ export const AtCapacity: Story = {
|
||||
queries: [
|
||||
{
|
||||
key: chatProjectSkillsKey(MockChatProject.id),
|
||||
data: Array.from({ length: 100 }, (_, index) => ({
|
||||
...mockSkills[0],
|
||||
id: `skill-${index}`,
|
||||
name: `skill-${index}`,
|
||||
})),
|
||||
data: mockSkillsAtCapacity,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -168,6 +173,37 @@ export const EditLoadError: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const DeleteConfirmation: Story = {
|
||||
play: async () => {
|
||||
await userEvent.click(
|
||||
await screen.findByRole("button", { name: "Open menu for reviewer" }),
|
||||
);
|
||||
await userEvent.click(
|
||||
await screen.findByRole("menuitem", { name: /Delete/ }),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export const DeleteError: Story = {
|
||||
beforeEach: () => {
|
||||
spyOn(API.experimental, "deleteChatProjectSkill").mockRejectedValue(
|
||||
mockApiError({ message: "Failed to delete project skill." }),
|
||||
);
|
||||
},
|
||||
play: async () => {
|
||||
await userEvent.click(
|
||||
await screen.findByRole("button", { name: "Open menu for reviewer" }),
|
||||
);
|
||||
await userEvent.click(
|
||||
await screen.findByRole("menuitem", { name: /Delete/ }),
|
||||
);
|
||||
await userEvent.click(
|
||||
await screen.findByRole("button", { name: "Delete skill" }),
|
||||
);
|
||||
await screen.findByText("Failed to delete project skill.");
|
||||
},
|
||||
};
|
||||
|
||||
export const ReadOnlyList: Story = {
|
||||
args: { canEdit: false },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user