Skip to content

Commit 6a0e663

Browse files
authored
fix(test): fix integration tests and add to CI (#221)
1 parent 886723e commit 6a0e663

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ jobs:
2424
- run: npm install
2525
- run: npm test
2626

27+
testint:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Use Node.js 24
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 24
35+
- run: npm install
36+
- run: npm run test:integration
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.INT_TEST_TOKEN }}
2739
action-in-action:
2840
runs-on: ubuntu-latest
2941
steps:

lib/meetings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function getNextIssue (opts) {
3232
title,
3333
date,
3434
agendaLabel: opts.agendaLabel,
35-
agendaIssues: opts.agendaIssues,
35+
agendaIssues: opts.agendaIssues || [],
3636
meetingLink: opts.meetingLink,
3737
labels: opts.meetingLabels,
3838
meetingNotes: opts.meetingNotes || '',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"scripts": {
1414
"build": "npx @vercel/ncc build",
1515
"test": "standard && mocha test/index.js",
16-
"test:integration": "standard && mocha",
16+
"test:integration": "standard && mocha test/integration.js",
17+
"test:integration:debug": "GITHUB_TOKEN=$(gh auth token) mocha --inspect --inspect-brk test/integration.js",
1718
"lint:fix": "standard --fix",
1819
"preversion": "npm t",
1920
"postpublish": "git push origin && git push origin --tags",

test/integration.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict'
2-
/* global Temporal */
32
require('dotenv').config()
43
const { suite, test, before } = require('mocha')
54
const assert = require('assert')
5+
/* global Temporal */
66
if (!global.Temporal) {
77
const polyfill = require('@js-temporal/polyfill')
88
global.Temporal = polyfill.Temporal
@@ -20,18 +20,21 @@ suite(`${pkg.name} integration`, () => {
2020
const issue = await meetings.shouldCreateNextMeetingIssue(client, {
2121
owner: 'wesleytodd',
2222
repo: 'meeting-maker',
23-
issueTitle: (date) => `Test Meeting ${date.toZonedDateTimeISO('UTC').toPlainDate().toString()}`,
23+
issueTitle: ({ date }) => `Test Meeting ${date.toZonedDateTimeISO('UTC').toPlainDate().toString()}`,
24+
createWithin: 'P7D',
25+
agendaLabel: 'meeting-agenda',
2426
schedules: [
2527
// 1pm GMT April 16 repeating every 28 days
2628
'2020-04-16T13:00:00.0Z/P28D'
2729
],
28-
now: Temporal.Instant.from('2020-04-13T13:00:00.0Z')
30+
now: Temporal.Instant.from('2020-04-13T13:00:00.0Z'),
31+
meetingLabels: ['testMeeting', 'test']
2932
})
3033
assert.deepStrictEqual(issue.owner, 'wesleytodd')
3134
assert.deepStrictEqual(issue.repo, 'meeting-maker')
3235
assert.deepStrictEqual(issue.title, `Test Meeting ${Temporal.Instant.from('2020-04-16T13:00:00.0Z').toZonedDateTimeISO('UTC').toPlainDate().toString()}`)
3336
assert.deepStrictEqual(issue.agendaLabel, 'meeting-agenda')
34-
assert.deepStrictEqual(issue.meetingLabels, ['testMeeting, test'])
37+
assert.deepStrictEqual(issue.labels, ['testMeeting', 'test'])
3538
assert(typeof issue.body === 'string')
3639
assert(Array.isArray(issue.agendaIssues))
3740
})
@@ -40,6 +43,7 @@ suite(`${pkg.name} integration`, () => {
4043
const issue = await meetings.createNextMeeting(client, {
4144
owner: 'wesleytodd',
4245
repo: 'meeting-maker',
46+
createWithin: 'P7D',
4347
schedules: [
4448
// 5pm GMT April 2 repeating every 28 days
4549
'2020-04-02T17:00:00.0Z/P28D',
@@ -48,8 +52,8 @@ suite(`${pkg.name} integration`, () => {
4852
'2020-04-16T13:00:00.0Z/P28D'
4953
],
5054
now: Temporal.Instant.from('2020-04-13T13:00:00.0Z'),
51-
issueTitle: (date) => `Test Meeting ${date.toZonedDateTimeISO('UTC').toPlainDate().toString()}`,
52-
labels: ['testMeeting', 'test']
55+
issueTitle: ({ date }) => `Test Meeting ${date.toZonedDateTimeISO('UTC').toPlainDate().toString()}`,
56+
meetingLabels: ['testMeeting', 'test']
5357
})
5458

5559
assert.deepStrictEqual(issue.data.title, `Test Meeting ${Temporal.Instant.from('2020-04-16T13:00:00.0Z').toZonedDateTimeISO('UTC').toPlainDate().toString()}`)

0 commit comments

Comments
 (0)