// Mock for shiki module export const createHighlighter = jest.fn().mockImplementation(() => { return Promise.resolve({ codeToHtml: jest.fn().mockImplementation((code, options) => { // Preserve the original code content and add variable elements if present let htmlContent = code; // Check for elements in the code and preserve them if (code.includes("")) { // Replace elements with tokenized spans htmlContent = code.replace( /(.*?)<\/var>/g, (match, content) => `${content}` ); } // Add test content for specific test cases if (code.includes("Salesforce Functions")) { htmlContent = "Connected to Salesforce Functions"; } return `
${htmlContent}
`; }), getLoadedLanguages: jest .fn() .mockReturnValue([ "javascript", "typescript", "html", "css", "apex", "text", "handlebars" ]), loadLanguage: jest.fn().mockResolvedValue(undefined) }); }); export type Highlighter = { codeToHtml: (code: string, options: any) => string; getLoadedLanguages: () => string[]; }; export type BundledLanguage = string; export type BundledTheme = string; export const codeToHast = jest.fn(); export const codeToHtml = jest.fn(); export const codeToTokens = jest.fn(); export const codeToTokensBase = jest.fn(); export const codeToTokensWithThemes = jest.fn(); export const getLastGrammarState = jest.fn(); export const getSingletonHighlighter = jest.fn(); // Mock for shiki/core exports export const createHighlighterCore = jest.fn().mockImplementation(() => { return Promise.resolve({ codeToHtml: jest.fn().mockImplementation((code, options) => { // Preserve the original code content and add variable elements if present let htmlContent = code; // Check for elements in the code and preserve them if (code.includes("")) { // Replace elements with tokenized spans htmlContent = code.replace( /(.*?)<\/var>/g, (match, content) => `${content}` ); } // Add test content for specific test cases if (code.includes("Salesforce Functions")) { htmlContent = "Connected to Salesforce Functions"; } return `
${htmlContent}
`; }), getLoadedLanguages: jest .fn() .mockReturnValue([ "javascript", "typescript", "html", "css", "apex", "text", "handlebars" ]), loadLanguage: jest.fn().mockResolvedValue(undefined) }); }); export type HighlighterCore = { codeToHtml: (code: string, options: any) => string; getLoadedLanguages: () => string[]; loadLanguage: (lang: any) => Promise; }; // Mock for shiki/engine/oniguruma export const createOnigurumaEngine = jest.fn().mockImplementation(() => { return Promise.resolve({}); }); // Mock for shiki/wasm - just return a promise that resolves to a buffer export default Promise.resolve(new ArrayBuffer(0));