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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
import { afterEach, describe, expect, it, vi } from 'vitest';
import {
getFontStackById,
getTextFontStack,
setCustomTextFontStacks,
subscribeToCustomTextFontStacks,
TEXT_FONT_STACKS,
} from './textConstants';
describe('textConstants custom font registry', () => {
afterEach(() => {
setCustomTextFontStacks([]);
});
it('notifies subscribers when custom fonts are updated', () => {
const listener = vi.fn();
const unsubscribe = subscribeToCustomTextFontStacks(listener);
setCustomTextFontStacks([
{
id: 'user:my font',
label: 'My Font',
stack: '"My Font",sans-serif',
aliases: ['user:fonts/MyFont-Regular.ttf'],
},
]);
expect(listener).toHaveBeenCalledTimes(1);
expect(getFontStackById('user:fonts/MyFont-Regular.ttf')).toBe('"My Font",sans-serif');
expect(getTextFontStack('user:fonts/MyFont-Regular.ttf')?.id).toBe('user:my font');
unsubscribe();
});
it('distinguishes missing custom font ids from known font stacks', () => {
expect(getTextFontStack('user:missing-font')).toBeUndefined();
expect(getFontStackById('user:missing-font')).toBe(TEXT_FONT_STACKS[0]?.stack ?? 'sans-serif');
});
});