Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

888 B
Raw Blame
/**
 * The table of fence tags (ui/highlight.ts) and the grammars that are really
 * registered (ui/highlight-code.tsx) are two lists in two files, because the
 * second one is loaded on demand. This holds them together: a tag that maps
 * to a grammar nobody registered would be coloured as plain text without
 * anyone noticing.
 */
import { describe, expect, it } from 'vitest'
import { HIGHLIGHT_GRAMMARS, highlightLanguage } from '../highlight'
import { GRAMMARS } from '../highlight-code'

describe('grammars of the code blocks', () => {
  it('every grammar the table names is registered, and none is registered for nothing', () => {
    expect(Object.keys(GRAMMARS).sort()).toEqual([...HIGHLIGHT_GRAMMARS])
  })

  it('every registered grammar answers to its own name', () => {
    for (const name of Object.keys(GRAMMARS)) expect(highlightLanguage(name), name).toBe(name)
  })
})