Skip to content

Commit

Permalink
refactor to Updater
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Wagner committed Jun 30, 2021
1 parent ae4ba6c commit 0beefbf
Show file tree
Hide file tree
Showing 16 changed files with 529 additions and 108 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
Expand All @@ -44,7 +44,9 @@
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/no-shadow": "error",
"no-shadow": "off"
},
"env": {
"node": true,
Expand Down
3 changes: 2 additions & 1 deletion __tests__/dependabot-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ describe('DependabotAPI', () => {
const api = new DependabotAPI(mockAxios, {
jobID: 1,
jobToken: 'xxx',
credentialsToken: 'yyy'
credentialsToken: 'yyy',
dependabotAPI: 'https://localhost'
})
beforeEach(jest.clearAllMocks)

Expand Down
17 changes: 17 additions & 0 deletions __tests__/updater.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Docker from 'dockerode'
import {Updater} from '../src/updater'

describe('Updater', () => {
const docker = new Docker()
const mockDependabotAPI: any = {
getJobDetails: jest.fn()
}
const updater = new Updater(docker, mockDependabotAPI)

it('should fetch job details', async () => {
mockDependabotAPI.getJobDetails.mockImplementation(() => {
throw new Error('kaboom')
})
updater.runUpdater()
})
})
10 changes: 0 additions & 10 deletions __tests__/updater/fetcher.test.ts

This file was deleted.

159 changes: 136 additions & 23 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 0beefbf

Please sign in to comment.