diff options
Diffstat (limited to 'test/options-util.test.js')
| -rw-r--r-- | test/options-util.test.js | 53 | 
1 files changed, 16 insertions, 37 deletions
| diff --git a/test/options-util.test.js b/test/options-util.test.js index c2050c3f..a178aecb 100644 --- a/test/options-util.test.js +++ b/test/options-util.test.js @@ -613,9 +613,22 @@ function createOptionsUpdatedTestData1() {      };  } +/** + * @param {string} templates + * @returns {Map<string, string>} + */ +function getHandlebarsPartials(templates) { +    const inlinePartialRegex = /{{~?#\*inline .*?"([^"]*)"~?}}.*?{{~?\/inline~?}}/gs; +    const matches = templates.matchAll(inlinePartialRegex); +    const partials = new Map(); +    for (const match of matches) { +        const [template, name] = match; +        partials.set(name, template); +    } +    return partials; +} -/** */ -async function testUpdate() { +describe('OptionsUtil', () => {      test('Update', async () => {          const optionsUtil = new OptionsUtil();          await optionsUtil.prepare(); @@ -625,24 +638,7 @@ async function testUpdate() {          const optionsExpected = createOptionsUpdatedTestData1();          expect(optionsUpdated).toStrictEqual(optionsExpected);      }); -} -/** */ -async function testCumulativeFieldTemplatesUpdates() { -    /** -     * @param {string} templates -     * @returns {Map<string, string>} -     */ -    const getHandlebarsPartials = (templates) => { -        const inlinePartialRegex = /{{~?#\*inline .*?"([^"]*)"~?}}.*?{{~?\/inline~?}}/gs; -        const matches = templates.matchAll(inlinePartialRegex); -        const partials = new Map(); -        for (const match of matches) { -            const [template, name] = match; -            partials.set(name, template); -        } -        return partials; -    };      test('CumulativeFieldTemplatesUpdates', async () => {          const optionsUtil = new OptionsUtil();          await optionsUtil.prepare(); @@ -661,10 +657,7 @@ async function testCumulativeFieldTemplatesUpdates() {          expect(partialsUpdated).toStrictEqual(partialsExpected);      }); -} -/** */ -async function testDefault() {      describe('Default', () => {          /** @type {((options: import('options-util').IntermediateOptions) => void)[]} */          const data = [ @@ -688,10 +681,7 @@ async function testDefault() {              expect(structuredClone(optionsUpdated)).toStrictEqual(structuredClone(options));          });      }); -} -/** */ -async function testFieldTemplatesUpdate() {      describe('FieldTemplatesUpdate', () => {          const templatePatcher = new TemplatePatcher();          /** @@ -1725,15 +1715,4 @@ async function testFieldTemplatesUpdate() {              expect(fieldTemplatesActual).toStrictEqual(expected2);          });      }); -} - - -/** */ -async function main() { -    await testUpdate(); -    await testDefault(); -    await testFieldTemplatesUpdate(); -    await testCumulativeFieldTemplatesUpdates(); -} - -await main(); +}); |