// Toasts/Tests/FT_ToastsEdgeCases.ts import { AC_ToastSystem } from '#root/Toasts/Components/AC_ToastSystem.ts'; import { EFunctionalTestResult } from '#root/UE/EFunctionalTestResult.ts'; import { FunctionalTest } from '#root/UE/FunctionalTest.ts'; import type { Integer } from '#root/UE/Integer.ts'; import { StringLibrary } from '#root/UE/StringLibrary.ts'; import type { Text } from '#root/UE/Text.ts'; import { TextLibrary } from '#root/UE/TextLibrary.ts'; /** * Functional Test: Toast System Edge Cases * Tests toast system robustness with unusual input conditions * Validates handling of empty, very long, and multiline messages */ export class FT_ToastsEdgeCases extends FunctionalTest { // ════════════════════════════════════════════════════════════════════════════════════════ // GRAPHS // ════════════════════════════════════════════════════════════════════════════════════════ // ──────────────────────────────────────────────────────────────────────────────────────── // EventGraph // ──────────────────────────────────────────────────────────────────────────────────────── /** * Test preparation - generates very long text for stress testing * Creates 500-character string to test text handling limits */ EventPrepareTest(): void { for (let i = 0; i < 500; i++) { this.longText = TextLibrary.StringToText( StringLibrary.Append(TextLibrary.TextToString(this.longText), 'A') ); } } /** * Test execution - validates edge case handling * Tests empty text, very long text, and multiline text scenarios */ EventStartTest(): void { this.ToastComponent.InitializeToastSystem(); // Test empty message handling this.emptyToast = this.ToastComponent.ShowToast(); // Test very long message handling (500 characters) this.longToast = this.ToastComponent.ShowToast(this.longText); // Test multiline message handling this.specialToast = this.ToastComponent.ShowToast(`Test Multiline Message`); /** * Check if all edge case toasts were created successfully */ const AreToastsCreatedSuccessfully = (): boolean => this.emptyToast > 0 && this.longToast > 0 && this.specialToast > 0; if (AreToastsCreatedSuccessfully()) { this.FinishTest(EFunctionalTestResult.Succeeded); } else { this.FinishTest( EFunctionalTestResult.Failed, `Edge case failures: empty=${this.emptyToast}, long=${this.longToast}, special=${this.specialToast}` ); } } // ════════════════════════════════════════════════════════════════════════════════════════ // VARIABLES // ════════════════════════════════════════════════════════════════════════════════════════ /** * Toast notification system - component under test * @category Components */ private ToastComponent = new AC_ToastSystem(); /** * ID of toast created with empty message * @category Test State */ private emptyToast: Integer = 0; /** * ID of toast created with very long message (500 chars) * @category Test State */ private longToast: Integer = 0; /** * ID of toast created with multiline message * @category Test State */ private specialToast: Integer = 0; /** * Generated long text string for stress testing * Built during test preparation phase * @category Test Data */ private longText: Text = ''; }