playwright-test-commons - v0.8.0
    Preparing search index...

    Function expectSortedByDate

    • Asserts (soft) that items are ordered by a date field. Reports every out-of-order pair.

      Parameters

      • items: readonly Record<string, unknown>[]

        the items, in the order received

      • key: string

        the date field on each item

      • order: "desc" | "asc" = "desc"

        "desc" (newest first) or "asc". Default "desc"

      • options: { format?: string } = {}

        how the dates are written

        • Optionalformat?: string

          dayjs format of the dates. Default: ISO 8601

      Returns void

      expectSortedByDate(body.items, "publishedAt", "desc");