Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamzolyak committed Nov 19, 2022
1 parent 4327956 commit 6a63b3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/actionTrigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"number": 88,
"title": "newissue3",
"state": "open",
"body": "blah blah [cow, api]"
"body": "blah blah [bir, pig]"
}
}
10 changes: 6 additions & 4 deletions tests/helpers.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const helpers = require('../helpers')
let octokit = require('@octokit/rest')()
const { Octokit } = require('@octokit/rest')

octokit = jest.fn()
octokit.authenticate = jest.fn()
Expand All @@ -22,22 +22,24 @@ describe('getBulkLabels', () => {
it('should return 1 bulk label if 1 bulk label exist in the issue body', async () => {
const eventIssueBody = 'checklist\r\n- [ ] to do\r\n[bug]'
const result = helpers.getBulkLabels(eventIssueBody)
console.log('result: ', result)

expect(Array.isArray(['bug'])).toBe(true)
expect(result).toEqual(expect.arrayContaining(['bug']))
})

it('should return 2 bulk labels if 2 bulk labels exist in the issue body', async () => {
const eventIssueBody = 'checklist\r\n- [ ] to do\r\n[bug, enh]'
const result = helpers.getBulkLabels(eventIssueBody)
console.log('result: ', result)

expect(Array.isArray(['bug', 'enh'])).toBe(true)
expect(result).toEqual(expect.arrayContaining(['bug', 'enh']))
})

it('should return 0 bulk labels if 0 bulk labels exist in the issue body', async () => {
const eventIssueBody = 'checklist\r\n- [ ] to do\r\n'
const result = helpers.getBulkLabels(eventIssueBody)

expect(Array.isArray([])).toBe(true)
expect(result).toEqual(expect.arrayContaining([]))
})
})

Expand Down

0 comments on commit 6a63b3a

Please sign in to comment.