Allow ts tests

This commit is contained in:
Adria Navarro 2024-02-21 23:16:54 +01:00
parent f782305219
commit 0b292f2e82
3 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@
*/
module.exports = {
preset: "ts-jest",
// All imported modules in your tests should be mocked automatically
// automock: false,

View File

@ -102,7 +102,11 @@ export async function processObject(object, context, opts) {
* @param {object|undefined} [opts] optional - specify some options for processing.
* @returns {Promise<string>} The enriched string, all templates should have been replaced if they can be.
*/
export async function processString(string, context, opts) {
export async function processString(
string: string,
context: object,
opts?: { noHelpers: boolean }
) {
// TODO: carry out any async calls before carrying out async call
return processStringSync(string, context, opts)
}

View File

@ -76,7 +76,7 @@ describe("Test that the object processing works correctly", () => {
it("should fail gracefully when object passed in has cycles", async () => {
let error = null
try {
const innerObj = { a: "thing {{ a }}" }
const innerObj: any = { a: "thing {{ a }}" }
innerObj.b = innerObj
await processObject(innerObj, { a: 1 })
} catch (err) {