Stratal API Reference
    Preparing search index...

    Class FakeStorageService

    FakeStorageService

    In-memory storage implementation for testing. Registered by default in TestingModuleBuilder.

    Similar to Laravel's Storage::fake() - stores files in memory and provides assertion helpers for testing.

    // Access via TestingModule
    module.storage.assertExists('path/to/file.pdf')
    module.storage.assertMissing('deleted/file.pdf')
    module.storage.clear() // Reset between tests

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    options: StorageConfig
    storageManager: StorageManagerService

    Methods

    • Build full path with disk root and path template substitution

      Parameters

      • relativePath: string

        Relative path within the disk

      • diskName: string

        Name of the disk

      Returns string

      Full path including disk root

    • Chunked upload (same as regular upload for fake)

      Parameters

      • body: StreamingBlobPayloadInputTypes | undefined
      • path: string
      • options: Omit<UploadOptions, "size"> & { size?: number }
      • Optionaldisk: string

      Returns Promise<
          {
              disk: string;
              fullPath: string;
              mimeType: string;
              path: string;
              size: number;
              uploadedAt: Date;
          },
      >

    • Get all available disk names

      Returns string[]

      Array of disk names

    • Generate a fake presigned delete URL

      Parameters

      • path: string
      • OptionalexpiresIn: number

      Returns Promise<
          {
              expiresAt: Date;
              expiresIn: number;
              method: "GET"
              | "PUT"
              | "DELETE"
              | "HEAD";
              url: string;
          },
      >

    • Generate a fake presigned download URL

      Parameters

      • path: string
      • OptionalexpiresIn: number

      Returns Promise<
          {
              expiresAt: Date;
              expiresIn: number;
              method: "GET"
              | "PUT"
              | "DELETE"
              | "HEAD";
              url: string;
          },
      >

    • Generate a fake presigned upload URL

      Parameters

      • path: string
      • OptionalexpiresIn: number

      Returns Promise<
          {
              expiresAt: Date;
              expiresIn: number;
              method: "GET"
              | "PUT"
              | "DELETE"
              | "HEAD";
              url: string;
          },
      >

    • Generate a presigned URL for any method

      Parameters

      • relativePath: string

        Relative path within the disk

      • method: "GET" | "PUT" | "DELETE" | "HEAD"

        HTTP method (GET, PUT, DELETE, HEAD)

      • OptionalexpiresIn: number

        Optional expiry time in seconds (uses default if not provided)

      • Optionaldisk: string

        Optional disk name (uses default if not provided)

      Returns Promise<
          {
              expiresAt: Date;
              expiresIn: number;
              method: "GET"
              | "PUT"
              | "DELETE"
              | "HEAD";
              url: string;
          },
      >

      Presigned URL result

    • Resolve disk name (use default if not provided)

      Parameters

      • Optionaldisk: string

        Optional disk name

      Returns string

      Resolved disk name

    • Substitute template variables in path Override this method in subclasses to add custom substitutions

      Parameters

      • path: string

        Path with template variables

      Returns string

      Path with substituted variables

    • Upload content to fake storage

      Parameters

      • body: StreamingBlobPayloadInputTypes | undefined
      • relativePath: string
      • options: UploadOptions
      • Optionaldisk: string

      Returns Promise<
          {
              disk: string;
              fullPath: string;
              mimeType: string;
              path: string;
              size: number;
              uploadedAt: Date;
          },
      >

    • Validate expiry time for presigned URLs

      Parameters

      • OptionalexpiresIn: number

        Optional expiry time in seconds

      Returns number

      Validated expiry time