Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

1.1 KB
Raw Blame
import { resolvedValues } from '@platform/core/resolvedValues.testing';
import { describe, expect, it } from 'vitest';

import { getNextPreviewComparisonMode } from './PreviewCompare';
import { DEFAULT_PREVIEW_COMPARISON_MODE, getPreviewComparisonMode } from './previewSettings';

describe('preview comparison settings', () => {
  it.each([
    ['defaults a missing persisted mode', {}, DEFAULT_PREVIEW_COMPARISON_MODE],
    ['defaults an invalid persisted mode to slider', { comparisonMode: 'invalid' }, 'slider'],
    ['restores the slider mode', { comparisonMode: 'slider' }, 'slider'],
    ['restores the side-by-side mode', { comparisonMode: 'side-by-side' }, 'side-by-side'],
    ['restores the hover mode', { comparisonMode: 'hover' }, 'hover'],
  ])('%s', (_, persisted, expected) => {
    expect(getPreviewComparisonMode(resolvedValues(persisted))).toBe(expected);
  });

  it('cycles all three comparison modes in order', () => {
    expect(getNextPreviewComparisonMode('slider')).toBe('side-by-side');
    expect(getNextPreviewComparisonMode('side-by-side')).toBe('hover');
    expect(getNextPreviewComparisonMode('hover')).toBe('slider');
  });
});