mcgilman commented on code in PR #11868:
URL: https://github.com/apache/nifi/pull/11868#discussion_r4460122272


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/current-user/current-user.effects.spec.ts:
##########
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { TestBed } from '@angular/core/testing';
+import { Router } from '@angular/router';
+import { provideMockActions } from '@ngrx/effects/testing';
+import { provideMockStore } from '@ngrx/store/testing';
+import { Action } from '@ngrx/store';
+import { SessionStorageService } from '@nifi/shared';
+import { firstValueFrom, Observable, of } from 'rxjs';
+import { CurrentUserEffects } from './current-user.effects';
+import { loadCurrentUserSuccess, navigateToLogIn } from 
'./current-user.actions';
+import { CurrentUserService } from '../../service/current-user.service';
+import { AuthService } from '../../service/auth.service';
+import { ErrorHelper } from '../../service/error-helper.service';
+import { RETURN_URL } from '../index';
+
+describe('CurrentUserEffects', () => {
+    const loadSuccess = loadCurrentUserSuccess({ response: { user: {} as any } 
});

Review Comment:
   Could we avoid bypassing the `CurrentUser` contract with `as any` here? 
Reusing the reducer's typed initial user keeps the fixture complete without 
duplicating every field:
   
   ```typescript
   import { initialState as currentUserInitialState } from 
'./current-user.reducer';
   
   const loadSuccess = loadCurrentUserSuccess({
       response: {
           user: currentUserInitialState.user
       }
   });
   ```
   
   Although this effect does not inspect the payload, retaining the real action 
type lets the test catch future contract changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to