mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 20:54:11 +00:00
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>
32 lines
1.1 KiB
TypeScript
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)
|
|
})
|
|
})
|