fix: fix all biome

This commit is contained in:
2025-01-31 05:57:51 +08:00
parent 316361bd3c
commit c9d0066d64
114 changed files with 2255 additions and 2068 deletions

View File

@@ -1,4 +1,3 @@
// biome-ignore lint/nursery/noEnum: <explanation>
export enum EventTypes {
/**
* This only works in the AppModule Constructor

View File

@@ -1,4 +1,4 @@
import { EventTypes } from './event-types';
import type { EventTypes } from './event-types';
export interface OidcClientNotification<T> {
type: EventTypes;

View File

@@ -1,4 +1,5 @@
import { TestBed } from '@/testing';
import { lastValueFrom } from 'rxjs';
import { filter } from 'rxjs/operators';
import { vi } from 'vitest';
import { EventTypes } from './event-types';
@@ -11,9 +12,6 @@ describe('Events Service', () => {
TestBed.configureTestingModule({
providers: [PublicEventsService],
});
});
beforeEach(() => {
eventsService = TestBed.inject(PublicEventsService);
});
@@ -23,20 +21,20 @@ describe('Events Service', () => {
it('registering to single event with one event emit works', async () => {
const firedEvent = await lastValueFrom(eventsService.registerForEvents());
expect(firedEvent).toBeTruthy();;
expect(firedEvent).toEqual({
type: EventTypes.ConfigLoaded,
value: { myKey: 'myValue' },
});
expect(firedEvent).toBeTruthy();
expect(firedEvent).toEqual({
type: EventTypes.ConfigLoaded,
value: { myKey: 'myValue' },
});
eventsService.fireEvent(EventTypes.ConfigLoaded, { myKey: 'myValue' });
});
it('registering to single event with multiple same event emit works', async () => {
const spy = jasmine.createSpy('spy');
const spy = vi.fn()('spy');
const firedEvent = await lastValueFrom(eventsService.registerForEvents());
spy(firedEvent);;
expect(firedEvent).toBeTruthy();
spy(firedEvent);
expect(firedEvent).toBeTruthy();
eventsService.fireEvent(EventTypes.ConfigLoaded, { myKey: 'myValue' });
eventsService.fireEvent(EventTypes.ConfigLoaded, { myKey: 'myValue2' });
@@ -45,21 +43,23 @@ expect(firedEvent).toBeTruthy();
type: EventTypes.ConfigLoaded,
value: { myKey: 'myValue' },
});
expect(spy.calls.mostRecent().args[0]).toEqual({
expect(spy.postSpy.mock.calls.at(-1)?.[0]).toEqual({
type: EventTypes.ConfigLoaded,
value: { myKey: 'myValue2' },
});
});
it('registering to single event with multiple emit works', async () => {
const firedEvent = await lastValueFrom(eventsService
.registerForEvents()
.pipe(filter((x) => x.type === EventTypes.ConfigLoaded)));
expect(firedEvent).toBeTruthy();;
expect(firedEvent).toEqual({
type: EventTypes.ConfigLoaded,
value: { myKey: 'myValue' },
});
const firedEvent = await lastValueFrom(
eventsService
.registerForEvents()
.pipe(filter((x) => x.type === EventTypes.ConfigLoaded))
);
expect(firedEvent).toBeTruthy();
expect(firedEvent).toEqual({
type: EventTypes.ConfigLoaded,
value: { myKey: 'myValue' },
});
eventsService.fireEvent(EventTypes.ConfigLoaded, { myKey: 'myValue' });
eventsService.fireEvent(EventTypes.NewAuthenticationResult, true);
});

View File

@@ -1,7 +1,7 @@
import { Injectable } from 'injection-js';
import { Observable, ReplaySubject } from 'rxjs';
import { EventTypes } from './event-types';
import { OidcClientNotification } from './notification';
import { type Observable, ReplaySubject } from 'rxjs';
import type { EventTypes } from './event-types';
import type { OidcClientNotification } from './notification';
@Injectable()
export class PublicEventsService {