Skip to content

Commit 2814486

Browse files
committed
build: fix broken CI
Fixes a test that is currently breaking CI.
1 parent 33f8855 commit 2814486

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎packages/core/test/resource/params_status_spec.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,19 @@ describe('resource with ResourceParamsStatus', () => {
120120

121121
it('should propagate a different error thrown from params', async () => {
122122
const s = signal<string | Error>('foo');
123-
const res = await actAsync(() =>
123+
const res = await act(() =>
124124
resource({
125125
params: throwStatusAndErrors(s),
126126
loader: async ({params}) => params as string,
127127
injector: TestBed.inject(Injector),
128128
}),
129129
);
130130

131-
await actAsync(() => s.set(new Error('first')));
131+
await act(() => s.set(new Error('first')));
132132
expect(res.status()).toBe('error');
133133
expect(res.error()).toEqual(new Error('first'));
134134

135-
await actAsync(() => s.set(new Error('second')));
135+
await act(() => s.set(new Error('second')));
136136
expect(res.status()).toBe('error');
137137
expect(res.error()).toEqual(new Error('second'));
138138
});
@@ -142,7 +142,7 @@ describe('resource with ResourceParamsStatus', () => {
142142
const s = signal<string | ResourceParamsStatus>(ResourceParamsStatus.LOADING);
143143
let paramsCount = 0;
144144
let loadCount = 0;
145-
const res = await actAsync(() =>
145+
const res = await act(() =>
146146
resource({
147147
params: () => {
148148
paramsCount++;
@@ -160,13 +160,13 @@ describe('resource with ResourceParamsStatus', () => {
160160
expect(res.status()).toBe('loading');
161161
expect(paramsCount).toBe(1);
162162

163-
await actAsync(() => unrelated.set(1));
163+
await act(() => unrelated.set(1));
164164

165165
expect(paramsCount).toBe(2);
166166
expect(res.status()).toBe('loading');
167167
expect(loadCount).toBe(0);
168168

169-
await actAsync(() => s.set('foo'));
169+
await act(() => s.set('foo'));
170170
expect(res.status()).toBe('resolved');
171171
expect(loadCount).toBe(1);
172172
});
@@ -175,7 +175,7 @@ describe('resource with ResourceParamsStatus', () => {
175175
const throwIt = signal(false);
176176
let loads = 0;
177177

178-
const res = await actAsync(() =>
178+
const res = await act(() =>
179179
resource({
180180
params: () => {
181181
if (throwIt()) {
@@ -194,7 +194,7 @@ describe('resource with ResourceParamsStatus', () => {
194194
expect(res.status()).toBe('idle');
195195
expect(loads).toBe(0);
196196

197-
await actAsync(() => throwIt.set(true));
197+
await act(() => throwIt.set(true));
198198

199199
expect(res.status()).toBe('error');
200200
expect(loads).toBe(0);

‎packages/core/test/resource/resource_spec.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,29 +1044,29 @@ describe('resource', () => {
10441044
injector: TestBed.inject(Injector),
10451045
});
10461046

1047-
await timeout();
1047+
await flushMicrotasks();
10481048
expect(loadCount).toBe(1);
10491049
expect(userResource.value()).toBe('user-1-1');
10501050

10511051
// Updating `routeParams` with a new object that has the same `id` should not re-run the loader
10521052
routeParams.set({id: '1', tab: 'orders'});
1053-
await timeout();
1053+
await flushMicrotasks();
10541054
expect(loadCount).toBe(1);
10551055
expect(userResource.value()).toBe('user-1-1');
10561056

10571057
// Even after a manual reload(), a subsequent signal update with the same `id` should not trigger another reload
10581058
userResource.reload();
1059-
await timeout();
1059+
await flushMicrotasks();
10601060
expect(loadCount).toBe(2);
10611061
expect(userResource.value()).toBe('user-1-2');
10621062

10631063
routeParams.set({id: '1', tab: 'settings'});
1064-
await timeout();
1064+
await flushMicrotasks();
10651065
expect(loadCount).toBe(2);
10661066
expect(userResource.value()).toBe('user-1-2');
10671067

10681068
routeParams.set({id: '2', tab: 'settings'});
1069-
await timeout();
1069+
await flushMicrotasks();
10701070
expect(loadCount).toBe(3);
10711071
expect(userResource.value()).toBe('user-2-3');
10721072
});

0 commit comments

Comments
 (0)