Skip to content

Commit 8bfb1d0

Browse files
chore: update tests
1 parent 6ef52bb commit 8bfb1d0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

ui/admin/app/components/agent/__tests__/Agent.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,17 @@ describe(Agent, () => {
114114
index ?? 0
115115
];
116116

117-
await userEvent.type(textbox, modifiedValue);
117+
await userEvent.type(textbox, modifiedValue, { delay: null });
118118
}
119119

120-
await waitFor(() => screen.getByText(/Saving|Saved/i), {
121-
timeout: 2000,
122-
});
123-
124-
expect(putSpy).toHaveBeenCalledWith(
125-
expect.objectContaining({
126-
[field]: expect.stringContaining(modifiedValue),
127-
})
120+
await waitFor(
121+
() =>
122+
expect(putSpy).toHaveBeenCalledWith(
123+
expect.objectContaining({
124+
[field]: expect.stringContaining(modifiedValue),
125+
})
126+
),
127+
{ timeout: 1000 }
128128
);
129129
});
130130

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

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

159159
expect(putSpy).toHaveBeenCalledWith(
160160
expect.objectContaining({
@@ -203,7 +203,7 @@ describe(Agent, () => {
203203
).getAllByRole("button")[1];
204204
await userEvent.click(imageDeleteButton);
205205

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

208208
expect(putSpy).toHaveBeenCalledWith(
209209
expect.objectContaining({

ui/admin/app/hooks/useDebounce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const useDebounce = <TParams extends unknown[]>(
66
delay: number
77
) => {
88
const timerRef = useRef<NodeJS.Timeout>();
9-
const effectiveDelay = import.meta.env.VITEST ? 100 : delay;
9+
const effectiveDelay = import.meta.env.VITEST ? 5 : delay;
1010

1111
const debouncedFn = useCallback(
1212
(...args: TParams) => {

0 commit comments

Comments
 (0)