Fixing LaTeX tests, adding new sexy natural language method spy, started testing Promises.

This commit is contained in:
Adsooi 2024-10-16 05:38:49 +02:00
parent a85a4721e3
commit 34caf20593
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
12 changed files with 511 additions and 35 deletions

View file

@ -23,6 +23,10 @@ const PIXEL = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAACklEQVR4AWNgAAAAA
export class MockLatex {
constructor() {
}
get supportsAsyncRender() {
return true
}
/**
* Creates a simple string hash.
@ -55,13 +59,23 @@ export class MockLatex {
return `${TMP}/${name}.png`
}
/**
* @param {string} markup - LaTeX markup to render
* @param {number} fontSize - Font size (in pt) to render
* @param {string} color - Color of the text to render
* @returns {Promise<string>} - Comma separated data of the image (source, width, height)
*/
async renderAsync(markup, fontSize, color) {
return this.renderSync(markup, fontSize, color)
}
/**
* @param {string} markup - LaTeX markup to render
* @param {number} fontSize - Font size (in pt) to render
* @param {string} color - Color of the text to render
* @returns {string} - Comma separated data of the image (source, width, height)
*/
render(markup, fontSize, color) {
renderSync(markup, fontSize, color) {
const file = this.__getFileName(markup, fontSize, color)
writeFileSync(file, PIXEL, "base64")
return `${file},1,1`
@ -87,4 +101,4 @@ export class MockLatex {
checkLatexInstallation() {
return true // We're not *actually* doing any latex.
}
}
}