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.0 KB
Raw Blame
import { describe, expect, it } from 'vitest';

import { getProjectCanvasSchemaRequirement, isCanvasSchemaVersionSupported } from './canvasSchemaVersion';

describe('getProjectCanvasSchemaRequirement', () => {
  it('uses only the live canvas schema version', () => {
    expect(
      getProjectCanvasSchemaRequirement({
        canvas: { version: 2 },
        queue: { items: [{ snapshot: { canvas: { version: 99 } } }] },
      })
    ).toBe(2);
  });

  it.each([
    ['the live canvas is missing', {}],
    ['the live version is malformed', { canvas: { version: '2' } }],
  ])('fails closed when %s', (_label, document) => {
    expect(() => getProjectCanvasSchemaRequirement(document)).toThrow();
  });
});

describe('isCanvasSchemaVersionSupported', () => {
  it('opens projects needing schema 3 through 8 and refuses the rest', () => {
    expect([2, 3, 4, 5, 6, 7, 8, 9].map(isCanvasSchemaVersionSupported)).toEqual([
      false,
      true,
      true,
      true,
      true,
      true,
      true,
      false,
    ]);
  });
});