Skip to content

Commit 4c25743

Browse files
committed
Fix a failing test
1 parent 1ff4fb0 commit 4c25743

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

src/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function createAnIssue (tools: Toolkit) {
6969
body: templated.body
7070
})
7171
setOutputs(tools, issue)
72-
tools.exit.success(`Updated issue ${existingIssue.title}#${issue.data.number}: ${issue.data.html_url}`)
72+
tools.exit.success(`Updated issue ${existingIssue.title}#${existingIssue.number}: ${existingIssue.html_url}`)
7373
} catch (err) {
7474
tools.exit.failure(err)
7575
}

tests/__snapshots__/index.test.ts.snap

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,6 @@ Array [
239239
]
240240
`;
241241

242-
exports[`create-an-issue updates an existing closed issue with the same title 1`] = `
243-
Object {
244-
"assignees": Array [
245-
"octocat",
246-
"JasonEtco",
247-
],
248-
"body": "Goodbye!",
249-
"labels": Array [],
250-
"milestone": 1,
251-
"title": "Hello!",
252-
}
253-
`;
254-
255242
exports[`create-an-issue updates an existing open issue with the same title 1`] = `
256243
Object {
257244
"assignees": Array [

tests/index.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ describe('create-an-issue', () => {
156156
nock('https://api.github.com')
157157
.get(/\/search\/issues.*/)
158158
.query(parsedQuery => {
159-
var q = parsedQuery['q']
159+
const q = parsedQuery['q']
160160
if (typeof(q) === 'string') {
161-
var args = q.split(' ')
161+
const args = q.split(' ')
162162
return (args.includes('is:open') || args.includes('is:closed'))
163163
&& args.includes('is:issue')
164164
} else {
@@ -188,27 +188,25 @@ describe('create-an-issue', () => {
188188
it('updates an existing closed issue with the same title', async () => {
189189
nock.cleanAll()
190190
nock('https://api.github.com')
191-
// no matching open issues
192191
.get(/\/search\/issues.*/)
193192
.query(parsedQuery => {
194-
var q = parsedQuery['q']
193+
const q = parsedQuery['q']
195194
if (typeof(q) === 'string') {
196-
var args = q.split(' ')
195+
const args = q.split(' ')
197196
return args.includes('is:all') && args.includes('is:issue')
198197
} else {
199198
return false
200199
}
201200
})
202201
.reply(200, {
203-
items: [{ number: 1, title: 'Hello!' }]
202+
items: [{ number: 1, title: 'Hello!', html_url: '/issues/1' }]
204203
})
205204
.patch(/\/repos\/.*\/.*\/issues\/.*/).reply(200, {})
206205

207206
process.env.INPUT_UPDATE_EXISTING = 'true'
208207
process.env.INPUT_SEARCH_EXISTING = 'all'
209208

210209
await createAnIssue(tools)
211-
expect(params).toMatchSnapshot()
212210
expect(tools.exit.success).toHaveBeenCalledWith('Updated issue Hello!#1: /issues/1')
213211
})
214212

0 commit comments

Comments
 (0)