Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhopperlowe committed Feb 10, 2025
1 parent 6ef52bb commit 8bfb1d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions ui/admin/app/components/agent/__tests__/Agent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ describe(Agent, () => {
index ?? 0
];

await userEvent.type(textbox, modifiedValue);
await userEvent.type(textbox, modifiedValue, { delay: null });
}

await waitFor(() => screen.getByText(/Saving|Saved/i), {
timeout: 2000,
});

expect(putSpy).toHaveBeenCalledWith(
expect.objectContaining({
[field]: expect.stringContaining(modifiedValue),
})
await waitFor(
() =>
expect(putSpy).toHaveBeenCalledWith(

Check failure on line 122 in ui/admin/app/components/agent/__tests__/Agent.test.tsx

View workflow job for this annotation

GitHub Actions / lint

app/components/agent/__tests__/Agent.test.tsx > Agent > Updating description triggers save

AssertionError: expected "spy" to be called with arguments: [ ObjectContaining{…} ] Received: 1st spy call: [ - ObjectContaining { - "description": StringContaining "lest accompany blissfully mealy", + { + "agents": null, + "alias": "", + "aliasAssigned": false, + "availableThreadTools": null, + "cache": null, + "created": "2025-01-29T12:49:07-05:00", + "defaultThreadTools": null, + "description": "l", + "env": null, + "icons": null, + "id": "a17m9ht", + "introductionMessage": "", + "knowledgeDescription": "", + "links": { + "invoke": "http://localhost:8080/api/invoke/a17m9ht", + }, + "model": "", + "name": "Grouchy Bacon", + "oauthApps": null, + "params": null, + "prompt": "", + "starterMessages": null, + "temperature": null, + "toolInfo": { + "database": { + "authorized": true, + }, + "knowledge": { + "authorized": true, + }, + "tasks": { + "authorized": true, + }, + "workspace-files": { + "authorized": true, + }, + }, + "tools": [ + "knowledge", + "workspace-files", + "database", + "tasks", + ], + "type": "agent", + "workflows": null, }, ] 2nd spy call: [ - ObjectContaining { - "description": StringContaining "lest accompany blissfully mealy", + { + "agents": null, + "alias": "", + "aliasAssigned": false, + "availableThreadTools": null, + "cache": null, + "created": "2025-01-29T12:49:07-05:00", + "defaultThreadTools": null, + "description": "le", + "env": null, + "icons": null, + "id": "a17m9ht", + "introductionMessage": "", + "knowledgeDescription": "", + "links": { + "invoke": "http://localhost:8080/api/invoke/a17m9ht", + }, + "model": "", + "name": "Grouchy Bacon", + "oauthApps": null, + "params": null, + "prompt": "", + "starterMessages": null, + "temperature": null, + "toolInfo": { + "database": { + "authorized": true, + }, + "knowledge": { + "authorized": true, + }, + "tasks": { + "authorized": true, + }, + "workspace-files": { + "authorized": true, + }, + }, + "tools": [ + "knowledge", + "workspace-files", + "database", + "tasks", + ], + "type": "agent", + "workflows": null, }, ] 3rd spy call: [ - ObjectContaining { - "description": StringContaining "lest accompany blissfully mealy", + { + "agents": null, + "alias": "", + "aliasAssigned": false, + "availableThreadTools": null, + "cache": null, + "created": "2025-01-29T12:49:07-05:00", + "defaultThreadTools": null, + "description": "let", + "env": null, + "icons": null, + "id": "a17m9ht", + "introductionMessage": "", + "knowledgeDescription": "", + "links": { + "invoke": "http://localhost:8080/api/invoke/a17m9ht", + }, + "model": "", + "name": "Grouchy Bacon", + "oauthApps": null, + "params": null, + "prompt": "", + "starterMessages": null, + "temperature": null, + "toolInfo": { + "database": { + "authorized": true, + }, + "knowledge": { + "authorized": true, + }, + "tasks": { + "authorized": true, + }, + "workspace-files": { + "authorized": true, + }, + }, + "tools": [ + "knowledge", + "workspace-files", + "database", + "tasks", + ], + "type": "agent", + "workflows": null, }, ] 4th spy call: [ - ObjectContaining { - "description": StringContaining "lest accompany blissfully mealy", + { + "agents": null, + "alias": "", + "aliasAssigned": false, + "availableThreadTools": null, + "cache": null, + "created": "2025-01-29T12:49:07-05:00", + "defaultThreadTools": null, + "description": "let ", + "env": nu
expect.objectContaining({
[field]: expect.stringContaining(modifiedValue),
})
),
{ timeout: 1000 }
);
});

Expand Down Expand Up @@ -154,7 +154,7 @@ describe(Agent, () => {
const iconSrc = iconSelections[0].getAttribute("src");
await userEvent.click(iconSelections[0]);

await waitFor(() => screen.getByText(/Saving|Saved/i));
await waitFor(() => expect(putSpy).toHaveBeenCalled(), { timeout: 20 });

expect(putSpy).toHaveBeenCalledWith(
expect.objectContaining({
Expand Down Expand Up @@ -203,7 +203,7 @@ describe(Agent, () => {
).getAllByRole("button")[1];
await userEvent.click(imageDeleteButton);

await waitFor(() => screen.getByText(/Saving|Saved/i));
await waitFor(() => expect(putSpy).toHaveBeenCalled(), { timeout: 20 });

expect(putSpy).toHaveBeenCalledWith(
expect.objectContaining({
Expand Down
2 changes: 1 addition & 1 deletion ui/admin/app/hooks/useDebounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const useDebounce = <TParams extends unknown[]>(
delay: number
) => {
const timerRef = useRef<NodeJS.Timeout>();
const effectiveDelay = import.meta.env.VITEST ? 100 : delay;
const effectiveDelay = import.meta.env.VITEST ? 5 : delay;

const debouncedFn = useCallback(
(...args: TParams) => {
Expand Down

0 comments on commit 8bfb1d0

Please sign in to comment.