All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.stories.components.main-header.stories.ts Maven / Gradle / Ivy

The newest version!
/*
 * SPDX-FileCopyrightText: 2017-2024 Enedis
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 */

import { Meta, moduleMetadata, StoryObj } from '@storybook/angular';
import { ChutneyMainHeaderComponent } from '@shared/components/layout/header/chutney-main-header.component';
import { LoginService } from '@core/services';
import { Authorization, User } from '@model';
import { Observable, of } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core';
import { TranslateTestingModule } from '../../app/testing/translate-testing.module';

const mockLoginService = {
  hasAuthorization(
    authorization: Array | Authorization = [],
    u: User = null,
  ): boolean {
    return true;
  },
  isAuthenticated(): boolean {
    return true;
  },
  getUser(): Observable {
    return of(new User("user_id", "username", "firstname"));
  },
};

export default {
  title: "Components/Main header",
  component: ChutneyMainHeaderComponent,
  decorators: [
    moduleMetadata({
      imports: [TranslateModule, TranslateTestingModule],
      providers: [{ provide: LoginService, useValue: mockLoginService }],
    }),
  ],
  args: {},
} as Meta;

type Story = StoryObj;

export const Default: Story = {};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy