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.

879 B
Raw Blame
import { accountLifecycle } from '@platform/state/accountLifecycle';
import { describe, expect, it } from 'vitest';

import { beginInvocationPreparation, endInvocationPreparation, isInvocationPreparing } from './invocationPreparation';

describe('invocation preparation', () => {
  it('does not let a stale account lease release a new preparation with the same project id', () => {
    const projectId = 'shared-project';
    const staleLease = beginInvocationPreparation(projectId);
    expect(staleLease).not.toBeNull();

    accountLifecycle.invalidate();
    const currentLease = beginInvocationPreparation(projectId);
    expect(currentLease).not.toBeNull();

    endInvocationPreparation(staleLease!);
    expect(isInvocationPreparing(projectId)).toBe(true);

    endInvocationPreparation(currentLease!);
    expect(isInvocationPreparing(projectId)).toBe(false);
  });
});