mirror of
https://github.com/langgenius/dify.git
synced 2026-08-28 19:16:51 +08:00
Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
23 lines
802 B
TypeScript
23 lines
802 B
TypeScript
import { renderHook } from '@testing-library/react'
|
|
import { useGetRunAndTraceUrl } from '../use-get-run-and-trace-url'
|
|
|
|
describe('useGetRunAndTraceUrl', () => {
|
|
it('should build snippet workflow run and trace urls from the snippet id', () => {
|
|
const { result } = renderHook(() => useGetRunAndTraceUrl('snippet-1'))
|
|
|
|
expect(result.current.getWorkflowRunAndTraceUrl('run-1')).toEqual({
|
|
runUrl: '/snippets/snippet-1/workflow-runs/run-1',
|
|
traceUrl: '/snippets/snippet-1/workflow-runs/run-1/node-executions',
|
|
})
|
|
})
|
|
|
|
it('should return empty urls when no run id is provided', () => {
|
|
const { result } = renderHook(() => useGetRunAndTraceUrl('snippet-1'))
|
|
|
|
expect(result.current.getWorkflowRunAndTraceUrl()).toEqual({
|
|
runUrl: '',
|
|
traceUrl: '',
|
|
})
|
|
})
|
|
})
|