video-ready.test.js 969 Bytes
import { describe, expect, it } from 'vitest'

import { render } from '../src/templates/video-ready.js'

const SITE_LOCALES = ['zh-CN', 'en', 'ja', 'ko', 'es', 'pt']

describe('video-ready email locale coverage', () => {
  it.each(SITE_LOCALES)('renders the %s notification', locale => {
    const message = render({
      locale,
      videoTitle: 'Localized title',
      videoSummary: 'Localized summary',
      videoUrl: 'https://voko.world/video-center.html',
    })

    expect(message.subject).toContain('Localized title')
    expect(message.text).toContain('Localized summary')
    expect(message.html).toContain('https://voko.world/video-center.html')
  })

  it('rejects Indonesian because it is not a visual-game site locale', () => {
    expect(() => render({
      locale: 'id',
      videoTitle: 'Title',
      videoSummary: 'Summary',
      videoUrl: 'https://voko.world/video-center.html',
    })).toThrow('video-ready: unsupported locale: id')
  })
})