From 635b0bfaefc102599b7ccf59c0a9bf62f6b68c85 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Fri, 22 Nov 2024 18:35:05 -0500 Subject: [PATCH] test: add test for shorthand transform --- lib/conversions.js | 2 ++ test/index.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/conversions.js b/lib/conversions.js index 6a6d2c4..8d03217 100644 --- a/lib/conversions.js +++ b/lib/conversions.js @@ -25,6 +25,8 @@ const templates = { } } +module.exports.templates = templates + const convert = async function (template) { /* - things to add from cutenode/action-meeting diff --git a/test/index.js b/test/index.js index 2b416ed..6298ed6 100644 --- a/test/index.js +++ b/test/index.js @@ -3,6 +3,7 @@ const { suite, test } = require('mocha') const assert = require('assert') const { DateTime } = require('luxon') const pkg = require('../package.json') +const { convert, templates } = require('../lib/conversions') const meetings = require('../lib/meetings') suite(`${pkg.name} unit`, () => { @@ -18,3 +19,22 @@ suite(`${pkg.name} unit`, () => { assert.deepStrictEqual(next.toISO(), DateTime.fromISO('2020-04-16T13:00:00.0Z').toISO()) }) }) + +test('shorthands transform', async () => { + templates.values.title = 'Test Meeting' + templates.values.agendaLabel = 'meeting-agenda' + templates.values.invitees = '@pkgjs/meet' + templates.values.observers = '@nodejs/package-maintenance' + + const input = `# + + +` + + const output = `# Test Meeting +meeting-agenda +@pkgjs/meet +@nodejs/package-maintenance` + + assert.equal(await convert(input), output) +})