Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

1.9 KB
Raw Blame
import { describe, expect, it } from 'vitest';
import { videoTranslationArtifactRefsPatch } from '../../src/creator/templates/video-translation-results.js';

describe('video translation result artifact refs', () => {
  it('preserves the sibling video when only one format is rendered', () => {
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: true,
      videoFormat: 'vertical',
      dubbing: false
    }, 'render-vertical')).not.toHaveProperty('horizontal_video');
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: true,
      videoFormat: 'horizontal',
      dubbing: false
    }, 'render-horizontal')).not.toHaveProperty('vertical_video');
  });

  it('keeps an explicitly rendered video even when composeVideo was not enabled in settings', () => {
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: false,
      videoFormat: 'horizontal',
      dubbing: false
    }, 'render-horizontal')).not.toHaveProperty('horizontal_video');
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: false,
      videoFormat: 'vertical',
      dubbing: false
    }, 'render-vertical')).not.toHaveProperty('vertical_video');
  });

  it('clears outputs that are invalidated by settings or an earlier workflow stage', () => {
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: true,
      videoFormat: 'all',
      dubbing: false
    }, 'render-horizontal')).toMatchObject({
      vertical_video: []
    });
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: false,
      videoFormat: 'vertical',
      dubbing: false
    })).toMatchObject({
      horizontal_video: [],
      vertical_video: []
    });
    expect(videoTranslationArtifactRefsPatch({
      composeVideo: true,
      videoFormat: 'vertical',
      dubbing: false
    }, 'subtitle')).toMatchObject({
      horizontal_video: [],
      vertical_video: []
    });
  });
});