cms.c2sgmbh/tests/unit/youtube/auto-status-transitions.unit.spec.ts
Martin Porwoll 8ae5841cc1 feat(youtube): add auto status transition hook
Automatically transitions YouTube content status when conditions are met
(e.g., upload_scheduled -> published when videoId is present) and sends
notifications to assigned users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:42:25 +00:00

32 lines
1.1 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { getNextStatus, shouldTransitionStatus } from '@/hooks/youtubeContent/autoStatusTransitions'
describe('Auto Status Transitions', () => {
it('should transition to published when upload is complete', () => {
const result = getNextStatus({
currentStatus: 'upload_scheduled',
youtubeVideoId: 'VID123',
hasAllChecklistsComplete: false,
})
expect(result).toBe('published')
})
it('should not transition if no video ID on upload_scheduled', () => {
const result = getNextStatus({
currentStatus: 'upload_scheduled',
youtubeVideoId: null,
hasAllChecklistsComplete: false,
})
expect(result).toBeNull()
})
it('should transition approved to upload_scheduled when video file exists', () => {
const result = shouldTransitionStatus('approved', { hasVideoFile: true })
expect(result).toBe(true)
})
it('should not suggest transition for published status', () => {
const result = shouldTransitionStatus('published', { hasVideoFile: true })
expect(result).toBe(false)
})
})