Skip to content

Commit 2464376

Browse files
Merge branch 'main' into feat/signals/extend-resource
2 parents 0fe6a31 + d17f55d commit 2464376

32 files changed

Lines changed: 263 additions & 74 deletions

modules/component-store/spec/component-store.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ describe('Component Store', () => {
13661366
);
13671367

13681368
it('complete when componentStore is destroyed', () =>
1369-
new Promise((doneFn) => {
1369+
new Promise<void>((doneFn) => {
13701370
const selector = componentStore.select(() => ({}), { debounce: true });
13711371

13721372
selector.subscribe({
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{ "path": "./tsconfig.build.json" },
7+
{ "path": "./tsconfig.schematics.json" },
8+
{ "path": "./tsconfig.spec.json" }
9+
]
10+
}

modules/component/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{ "path": "./tsconfig.build.json" },
7+
{ "path": "./tsconfig.schematics.json" },
8+
{ "path": "./tsconfig.spec.json" }
9+
]
10+
}

modules/data/spec/effects/entity-effects.marbles.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
// Using marble testing
22
import { TestBed } from '@angular/core/testing';
33

4-
import { cold, hot, getTestScheduler } from './marbles';
54
import { Observable } from 'rxjs';
5+
import { cold, getTestScheduler, hot } from './marbles';
66

77
import { Actions } from '@ngrx/effects';
8-
import { Update } from '@ngrx/entity';
98
import { provideMockActions } from '@ngrx/effects/testing';
9+
import { Update } from '@ngrx/entity';
10+
import { Mock, vi } from 'vitest';
1011
import {
11-
EntityEffects,
12+
DataServiceError,
13+
DefaultPersistenceResultHandler,
14+
EntityAction,
15+
EntityActionDataServiceError,
1216
EntityActionFactory,
1317
EntityDataService,
14-
PersistenceResultHandler,
15-
DefaultPersistenceResultHandler,
18+
EntityEffects,
1619
EntityOp,
1720
HttpMethods,
18-
DataServiceError,
19-
EntityAction,
20-
makeErrorOp,
21-
EntityActionDataServiceError,
2221
Logger,
22+
makeErrorOp,
23+
PersistenceResultHandler,
2324
} from '../..';
2425
import { ENTITY_EFFECTS_SCHEDULER } from '../../src/effects/entity-effects-scheduler';
25-
import { Mock, vi } from 'vitest';
2626

2727
//////// Tests begin ////////
2828
describe('EntityEffects (marble testing)', () => {
@@ -448,7 +448,7 @@ describe('EntityEffects (marble testing)', () => {
448448
const action = entityActionFactory.create('Hero', EntityOp.REMOVE_ALL);
449449

450450
actions = hot('-a---', { a: action });
451-
const expected = cold('---');
451+
const expected = cold<never>('---');
452452

453453
expect(effects.persist$).toBeObservable(expected);
454454
});

modules/data/spec/effects/marbles.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,24 @@ export function cold<T = unknown>(
1818
marbles: string,
1919
values?: Record<string, T>,
2020
error?: unknown
21-
): Observable<T> {
22-
return scheduler.createColdObservable(marbles, values, error);
21+
): MarbleObservable<T> {
22+
return scheduler.createColdObservable(
23+
marbles,
24+
values,
25+
error
26+
) as MarbleObservable<T>;
2327
}
2428

2529
export function hot<T = unknown>(
2630
marbles: string,
2731
values?: Record<string, T>,
2832
error?: unknown
29-
): Observable<T> {
30-
return scheduler.createHotObservable(marbles, values, error);
33+
): MarbleObservable<T> {
34+
return scheduler.createHotObservable(
35+
marbles,
36+
values,
37+
error
38+
) as MarbleObservable<T>;
3139
}
3240

3341
expect.extend({
@@ -79,6 +87,8 @@ expect.extend({
7987

8088
declare module 'vitest' {
8189
interface Assertion<T = unknown> {
82-
toBeObservable(expected: MarbleObservable<T>): T;
90+
toBeObservable(
91+
expected: MarbleObservable<T extends Observable<infer V> ? V : T>
92+
): void;
8393
}
8494
}

modules/data/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{ "path": "./tsconfig.build.json" },
7+
{ "path": "./tsconfig.schematics.json" },
8+
{ "path": "./tsconfig.spec.json" }
9+
]
10+
}

modules/effects/spec/effect_sources.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,14 @@ describe('EffectSources', () => {
419419
testScheduler.run(({ hot, expectObservable }) => {
420420
const sources$ = of(
421421
new (class {
422-
b$ = createEffect(() =>
423-
hot('a--e--b--e--c--e--d').pipe(
424-
map((v) => {
425-
if (v == 'e') throw new Error('An Error');
426-
return v;
427-
})
428-
)
422+
b$ = createEffect(
423+
() =>
424+
hot('a--e--b--e--c--e--d').pipe(
425+
map((v) => {
426+
if (v == 'e') throw new Error('An Error');
427+
return v;
428+
})
429+
) as any
429430
);
430431
})()
431432
);
@@ -493,11 +494,11 @@ describe('EffectSources', () => {
493494
});
494495

495496
it('should not complete the group if just one effect completes', () => {
496-
testScheduler.run(({ cold, expectObservable, scheduler }) => {
497+
testScheduler.run(({ cold, expectObservable }) => {
497498
class SourceH {
498499
empty = createEffect(() => of('value') as any);
499500
never = createEffect(
500-
() => timer(5, scheduler).pipe(map(() => 'update')) as any
501+
() => timer(5, testScheduler).pipe(map(() => 'update')) as any
501502
);
502503
}
503504

modules/effects/spec/effects_error_handler.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ describe('Effects Error Handler', () => {
3636
});
3737

3838
globalErrorHandler = TestBed.inject(ErrorHandler)
39-
.handleError as MockInstance;
39+
.handleError as unknown as MockInstance;
4040
const store = TestBed.inject(Store);
41-
storeNext = store.next as MockInstance;
41+
storeNext = store.next as unknown as MockInstance;
4242
}
4343

4444
it('should retry on infinite error up to 10 times', () => {

modules/effects/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{ "path": "./tsconfig.build.json" },
7+
{ "path": "./tsconfig.schematics.json" },
8+
{ "path": "./tsconfig.spec.json" }
9+
]
10+
}

modules/entity/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{ "path": "./tsconfig.build.json" },
7+
{ "path": "./tsconfig.schematics.json" },
8+
{ "path": "./tsconfig.spec.json" }
9+
]
10+
}

0 commit comments

Comments
 (0)