/*
 * 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 { GlobalAccessPolicies } from './global-access-policies.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideMockStore } from '@ngrx/store/testing';
import { initialState } from '../../state/access-policy/access-policy.reducer';
import { initialState as initialErrorState } from '../../../../state/error/error.reducer';
import { errorFeatureKey } from '../../../../state/error';
import { accessPoliciesFeatureKey } from '../../state';
import { accessPolicyFeatureKey } from '../../state/access-policy';
import { tenantsFeatureKey } from '../../state/tenants';
import { initialState as initialTenantsState } from '../../state/tenants/tenants.reducer';
import { policyComponentFeatureKey } from '../../state/policy-component';
import { initialState as initialPolicyComponentState } from '../../state/policy-component/policy-component.reducer';
import { currentUserFeatureKey } from '../../../../state/current-user';
import { initialState as initialCurrentUserState } from '../../../../state/current-user/current-user.reducer';
import { extensionTypesFeatureKey } from '../../../../state/extension-types';
import { initialExtensionsTypesState } from '../../../../state/extension-types/extension-types.reducer';
import { flowConfigurationFeatureKey } from '../../../../state/flow-configuration';
import * as fromFlowConfiguration from '../../../../state/flow-configuration/flow-configuration.reducer';
import { NgxSkeletonLoaderComponent } from 'ngx-skeleton-loader';
import { selectCurrentRoute } from '@nifi/shared';

describe('GlobalAccessPolicies', () => {
    let component: GlobalAccessPolicies;
    let fixture: ComponentFixture<GlobalAccessPolicies>;

    beforeEach(() => {
        TestBed.configureTestingModule({
            declarations: [GlobalAccessPolicies],
            imports: [NgxSkeletonLoaderComponent],
            providers: [
                provideMockStore({
                    initialState: {
                        [errorFeatureKey]: initialErrorState,
                        [currentUserFeatureKey]: initialCurrentUserState,
                        [extensionTypesFeatureKey]: initialExtensionsTypesState,
                        [flowConfigurationFeatureKey]: fromFlowConfiguration.initialState,
                        [accessPoliciesFeatureKey]: {
                            [accessPolicyFeatureKey]: initialState,
                            [tenantsFeatureKey]: initialTenantsState,
                            [policyComponentFeatureKey]: initialPolicyComponentState
                        }
                    },
                    selectors: [
                        {
                            selector: selectCurrentRoute,
                            value: {
                                params: {},
                                routeConfig: { path: 'global' },
                                url: []
                            }
                        }
                    ]
                })
            ]
        });
        fixture = TestBed.createComponent(GlobalAccessPolicies);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

    it('should create', () => {
        expect(component).toBeTruthy();
    });
});
