Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

758 B
Raw Blame
import { formatWorkflowRunIdentifier } from '../common'

describe('formatWorkflowRunIdentifier', () => {
  it('should return fallback text when finishedAt is undefined', () => {
    expect(formatWorkflowRunIdentifier()).toBe(' (Running)')
  })

  it('should return fallback text when finishedAt is 0', () => {
    expect(formatWorkflowRunIdentifier(0)).toBe(' (Running)')
  })

  it('should capitalize custom fallback text', () => {
    expect(formatWorkflowRunIdentifier(undefined, 'pending')).toBe(' (Pending)')
  })

  it('should format a valid timestamp', () => {
    const timestamp = 1704067200 // 2024-01-01 00:00:00 UTC
    const result = formatWorkflowRunIdentifier(timestamp)
    expect(result).toMatch(/^ \(\d{2}:\d{2}:\d{2}( [AP]M)?\)$/)
  })
})