Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for shorthand transform #210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 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,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 = `# <!-- title -->
<!-- agenda label -->
<!-- invitees -->
<!-- observers -->`

const output = `# Test Meeting
meeting-agenda
@pkgjs/meet
@nodejs/package-maintenance`

assert.equal(await convert(input), output)
})