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.

1.0 KB
Raw Blame
import { describe, expect, it } from 'vite-plus/test'
import {
  assertCucumberScenariosStarted,
  countStartedCucumberScenarios,
} from '../support/cucumber-messages.ts'

describe('countStartedCucumberScenarios', () => {
  it('counts test case start messages', () => {
    const report = [
      JSON.stringify({ meta: { protocolVersion: '32.3.1' } }),
      JSON.stringify({ testCaseStarted: { id: 'first' } }),
      JSON.stringify({ testCaseStarted: { id: 'second' } }),
      '',
    ].join('\n')

    expect(countStartedCucumberScenarios(report)).toBe(2)
  })

  it('returns zero when the selector starts no scenarios', () => {
    const report = [
      JSON.stringify({ meta: { protocolVersion: '32.3.1' } }),
      JSON.stringify({ testRunStarted: { timestamp: {} } }),
      JSON.stringify({ testRunFinished: { timestamp: {} } }),
    ].join('\n')

    expect(countStartedCucumberScenarios(report)).toBe(0)
    expect(() => assertCucumberScenariosStarted(report)).toThrow(
      'Cucumber selected zero scenarios.',
    )
  })
})