All files / runtime/_collections unique-generator.util.ts

100% Statements 57/57
100% Branches 6/6
100% Functions 5/5
100% Lines 57/57

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 581x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 103x 103x 103x 103x 103x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * MP-07 SP-C lift — generic unique-value generator E2E-teszteléshez.
 *
 * Eredete: `@futdevpro/fdp-e2e-helpers/_collections/e2e-unique-generator.util.ts`
 * (BL-20260518-004). A domain-rész paraméterezhetővé téve (FDP-konkrét
 * `@test.futdevpro.hu` → consumer-config) hogy generic legyen.
 *
 * Pure static class — multi-worker safe (NO instance state). Pattern:
 * `<prefix>-<context>-<timestamp>-<random>` formátum. Cross-worker
 * collision-rate ~1/10000 (random 0..9999 + ms-precision timestamp).
 */
export class DyE2E_UniqueGenerator_Util {
 
  /** A test-emailek domain-szegmense — consumer-projekt felülírhatja. */
  static defaultEmailDomain: string = 'test.example.com';
 
  /**
   * Egyedi e-mail-cím generálás.
   *
   * Formátum: `<prefix>-<context>-<timestamp>-<random>@<domain>`.
   */
  static generateUniqueEmail(prefix: string, context: string, domain?: string): string {
    const timestamp: number = Date.now();
    const random: number = Math.floor(Math.random() * 10000);
    const d: string = domain ?? DyE2E_UniqueGenerator_Util.defaultEmailDomain;
    return `${prefix}-${context}-${timestamp}-${random}@${d}`;
  }
 
  /**
   * Egyedi username generálás.
   */
  static generateUniqueUsername(prefix: string, context: string): string {
    const timestamp: number = Date.now();
    const random: number = Math.floor(Math.random() * 10000);
    return `${prefix}-${context}-${timestamp}-${random}`;
  }
 
  /**
   * Egyedi password — **NEM crypto-strength**, csak unique-marker E2E-hez.
   *
   * Production-password-flow tesztelésre policy-aware generator (Wave-3+).
   */
  static generateUniquePassword(prefix: string): string {
    const timestamp: number = Date.now();
    const random: number = Math.floor(Math.random() * 10000);
    return `${prefix}-${timestamp}-${random}`;
  }
 
  /**
   * Egyedi opaque token (uuid-szerű, NEM RFC4122 uuid).
   */
  static generateUniqueToken(): string {
    const timestamp: number = Date.now();
    const random: number = Math.floor(Math.random() * 1_000_000_000);
    return `${timestamp.toString(16)}-${random.toString(16)}`;
  }
}