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

import { FEATURE_HINTS } from './hintRegistry';

/** Check registry/catalog parity both ways; generic static-key scanning misses interpolated hint keys. */

const enModules = import.meta.glob('../../../../public/locales/en.json', { eager: true, import: 'default' });
const en = Object.values(enModules)[0] as Record<string, unknown>;
const catalog = (en.hints ?? {}) as Record<string, { heading?: unknown; paragraphs?: unknown }>;

const registryIds = Object.keys(FEATURE_HINTS).sort();

describe('feature hint registry', () => {
  it('gives every registered hint a heading and at least one paragraph', () => {
    const incomplete = registryIds.filter((id) => {
      const entry = catalog[id];

      return (
        typeof entry?.heading !== 'string' ||
        entry.heading.length === 0 ||
        !Array.isArray(entry.paragraphs) ||
        entry.paragraphs.length === 0 ||
        entry.paragraphs.some((paragraph) => typeof paragraph !== 'string' || paragraph.length === 0)
      );
    });

    expect(incomplete).toEqual([]);
  });

  it('registers every catalog entry, so no copy is unreachable', () => {
    expect(Object.keys(catalog).sort()).toEqual(registryIds);
  });

  it('points every "learn more" link at an absolute https URL', () => {
    const bad = Object.entries(FEATURE_HINTS)
      .filter(([, definition]) => 'href' in definition && !definition.href.startsWith('https://'))
      .map(([id]) => id);

    expect(bad).toEqual([]);
  });
});