Skip to content

Commit f554ee6

Browse files
committed
refactor: addressing comments
1 parent df596ae commit f554ee6

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

projects/components/src/notification/notification.service.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('NotificationService', () => {
6060
test('withNotification should work correctly', () => {
6161
spectator = createService();
6262

63-
spectator.service.withNotification(of(true), 'success', 'failure').subscribe();
63+
spectator.service.wrapWithNotification(of(true), 'success', 'failure').subscribe();
6464

6565
expect(spectator.inject(MatSnackBar).openFromComponent).toHaveBeenLastCalledWith(
6666
NotificationComponent,
@@ -72,7 +72,7 @@ describe('NotificationService', () => {
7272
})
7373
);
7474

75-
spectator.service.withNotification(throwError('error'), 'success', 'failure').subscribe();
75+
spectator.service.wrapWithNotification(throwError('error'), 'success', 'failure').subscribe();
7676

7777
expect(spectator.inject(MatSnackBar).openFromComponent).toHaveBeenLastCalledWith(
7878
NotificationComponent,
@@ -88,7 +88,7 @@ describe('NotificationService', () => {
8888
test('withNotification operator should work correctly', () => {
8989
spectator = createService();
9090

91-
of(true).pipe(spectator.service.withNotificationOperator('success', 'failure')).subscribe();
91+
of(true).pipe(spectator.service.withNotification('success', 'failure')).subscribe();
9292

9393
expect(spectator.inject(MatSnackBar).openFromComponent).toHaveBeenLastCalledWith(
9494
NotificationComponent,
@@ -100,7 +100,7 @@ describe('NotificationService', () => {
100100
})
101101
);
102102

103-
throwError('error').pipe(spectator.service.withNotificationOperator('success', 'failure')).subscribe();
103+
throwError('error').pipe(spectator.service.withNotification('success', 'failure')).subscribe();
104104

105105
expect(spectator.inject(MatSnackBar).openFromComponent).toHaveBeenLastCalledWith(
106106
NotificationComponent,

projects/components/src/notification/notification.service.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class NotificationService {
5050
});
5151
}
5252

53-
public withNotification<T>(source: Observable<T>, successMessage: string, failureMessage: string): Observable<T> {
53+
public wrapWithNotification<T>(source: Observable<T>, successMessage: string, failureMessage: string): Observable<T> {
5454
return source.pipe(
5555
tap(
5656
noop,
@@ -60,10 +60,7 @@ export class NotificationService {
6060
);
6161
}
6262

63-
public withNotificationOperator<T>(
64-
successMessage: string,
65-
failureMessage: string
66-
): (source: Observable<T>) => Observable<T> {
67-
return (source: Observable<T>) => this.withNotification(source, successMessage, failureMessage);
63+
public withNotification<T>(successMessage: string, failureMessage: string): (source: Observable<T>) => Observable<T> {
64+
return (source: Observable<T>) => this.wrapWithNotification(source, successMessage, failureMessage);
6865
}
6966
}

0 commit comments

Comments
 (0)