This commit significantly expands the application's routing, navigation, and administrative capabilities. It introduces several new functional modules and refines the core layout for a more professional, dashboard-oriented experience. - **Routing & Navigation**: - Added routes for `wallboard`, `call-center`, `call-center/calls`, and `chat-questions`. - Updated `SidebarComponent` to include all new navigation items. - Enhanced `LayoutComponent` with dynamic navigation based on user roles (admin vs. user). - **New Administrative Pages**: - `WallboardPage`: Implements a real-time KPI dashboard with call activity trends and outcome distributions. - `CallCenterPage`: Provides a symbolic interface for managing call center connectivity and synchronization. - `CallCenterCallsPage`: Implements a call history retrieval interface with filtering capabilities. - `ChatQuestionsPage`: Adds a module for reviewing user questions from web and mobile channels. - **Core Infrastructure & Refinement**: - Updated `AppConfig` to include an `APP_INITIALIZER` for validating user identity via `AuthService` on startup. - Refined `HomeComponent` layout to a "Claude-style" continuous chat column. - Implemented global themed scrollbars and integrated the 'Lahze' font family. - Added `proxy.conf.json` and updated `angular.json` to support local backend development. - **Documentation**: - Added comprehensive API handoff guides for frontend-backend connection and MVP API catalog.
78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
import { TestBed } from '@angular/core/testing';
|
||
import { provideZonelessChangeDetection } from '@angular/core';
|
||
import { provideAnimations } from '@angular/platform-browser/animations';
|
||
import { provideHttpClient } from '@angular/common/http';
|
||
import { provideRouter } from '@angular/router';
|
||
import { TOAST_CONFIG, DefaultGlobalConfig } from 'ngx-toastr';
|
||
import { firstValueFrom } from 'rxjs';
|
||
import { WallboardService } from './wallboard.service';
|
||
|
||
describe('WallboardService', () => {
|
||
let service: WallboardService;
|
||
|
||
beforeEach(() => {
|
||
TestBed.configureTestingModule({
|
||
providers: [
|
||
provideZonelessChangeDetection(),
|
||
provideHttpClient(),
|
||
provideRouter([]),
|
||
provideAnimations(),
|
||
{ provide: TOAST_CONFIG, useValue: { default: DefaultGlobalConfig, config: {} } },
|
||
],
|
||
});
|
||
service = TestBed.inject(WallboardService);
|
||
});
|
||
|
||
it('should be created', () => {
|
||
expect(service).toBeTruthy();
|
||
});
|
||
|
||
it('returns KPIs with a consistent AI breakdown', async () => {
|
||
const kpis = await firstValueFrom(service.getKpis());
|
||
|
||
expect(kpis.totalCalls).toBeGreaterThan(0);
|
||
expect(kpis.aiCalls).toBeGreaterThan(0);
|
||
expect(kpis.aiCalls).toBeLessThanOrEqual(kpis.totalCalls);
|
||
expect(kpis.successfulAiCalls + kpis.transferredToAgentCalls).toBe(kpis.aiCalls);
|
||
expect(kpis.avgAiTalkSeconds).toBeGreaterThan(0);
|
||
});
|
||
|
||
it('returns outcome shares summing up to the total call count', async () => {
|
||
const outcomes = await firstValueFrom(service.getOutcomes());
|
||
const kpis = await firstValueFrom(service.getKpis());
|
||
const total = outcomes.reduce((sum, outcome) => sum + outcome.value, 0);
|
||
|
||
expect(outcomes.length).toBeGreaterThan(0);
|
||
expect(total).toBe(kpis.totalCalls);
|
||
});
|
||
|
||
it('returns a 14 point activity trend with valid labels', async () => {
|
||
const activity = await firstValueFrom(service.getActivity());
|
||
|
||
expect(activity).toHaveLength(14);
|
||
activity.forEach((point) => {
|
||
expect(point.label).toBeTruthy();
|
||
expect(point.count).toBeGreaterThan(0);
|
||
});
|
||
});
|
||
|
||
it('returns hourly buckets covering the whole working day', async () => {
|
||
const hourly = await firstValueFrom(service.getHourlyDistribution());
|
||
|
||
expect(hourly.length).toBeGreaterThan(0);
|
||
hourly.forEach((bucket) => {
|
||
expect(bucket.label).toMatch(/–/);
|
||
expect(bucket.count).toBeGreaterThan(0);
|
||
});
|
||
});
|
||
|
||
it('returns a complete overview combining every wallboard dataset', async () => {
|
||
const overview = await firstValueFrom(service.getOverview());
|
||
|
||
expect(overview.kpis.totalCalls).toBeGreaterThan(0);
|
||
expect(overview.outcomes.length).toBeGreaterThan(0);
|
||
expect(overview.activity).toHaveLength(14);
|
||
expect(overview.hourly.length).toBeGreaterThan(0);
|
||
});
|
||
});
|