Skip to content

Commit

Permalink
test: add test for shorthand transform
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohansebas committed Nov 22, 2024
1 parent 61042a3 commit 6b21ccf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const templates = {
}
}

module.exports.templates = templates

const convert = async function (template) {
/*
- things to add from cutenode/action-meeting
Expand Down
19 changes: 19 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`, () => {
Expand All @@ -18,3 +19,21 @@ suite(`${pkg.name} unit`, () => {
assert.deepStrictEqual(next.toISO(), DateTime.fromISO('2020-04-16T13:00:00.0Z').toISO())
})
})

test('convert shorthands', async () => {
templates.values.title = 'Test Meeting'
templates.values.agendaLabel = 'meeting-agenda'
templates.values.invitees = '@pkgjs/meet'
templates.values.observers = '@nodejs/package-maintenance'

const input = `# <!-- title -->
<!-- agenda label -->
<!-- invitees -->
<!-- observers -->`

const output = `# Test Meeting
meeting-agenda
@pkgjs/meet
@nodejs/package-maintenance`
assert.equal(await convert(input), output)
})

0 comments on commit 6b21ccf

Please sign in to comment.