Skip to content
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
4 changes: 2 additions & 2 deletions lib/search.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This helper goes and fetches Good First Issues
// This module expects a search query which is just a standard GitHub search query. These queries should not include sort or order, since those are defined in the function.
const Octokit = require('@octokit/rest')
const { Octokit } = require('@octokit/rest')

/// GitHub search parameters for the Node.js org
const SORT = 'updated'
Expand All @@ -15,7 +15,7 @@ const PAGE = 1 // page_number is 1-based index
const MAX_PAGE_ALLOWED = 34

async function search (q, auth) {
const octokit = auth ? Octokit({ auth }) : Octokit()
const octokit = auth ? new Octokit({ auth }) : new Octokit()

const { data } = await octokit.search.issuesAndPullRequests(getSearchParams({ q }))

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"email": "hello@bnb.im"
},
"dependencies": {
"@octokit/rest": "^16.0.1"
"@octokit/rest": "^18.0.6"
},
"devDependencies": {
"jest": "^23.6.0",
Expand Down
13 changes: 8 additions & 5 deletions tests/search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ beforeEach(() => {
jest.restoreAllMocks()
jest.resetAllMocks()
issuesAndPullRequests = jest.fn()
jest.doMock('@octokit/rest', () => () => {
return {
search: {
issuesAndPullRequests
jest.doMock("@octokit/rest", () => ({
// cannot use arrow function here because we can't call new on arrow function
Octokit: function () {
return {
search: {
issuesAndPullRequests
}
}
}
})
}))
search = require('../lib/search')
})

Expand Down