Mock octokit.

This commit is contained in:
Federico Builes
2023-04-06 17:11:16 +02:00
parent 0041d7fa41
commit 153f274eb4

View File

@@ -31,6 +31,28 @@ function clearInputs(): void {
})
}
const externalConfig = `fail_on_severity: 'high'
allow_licenses: ['GPL-2.0-only']
`
const mockOctokit = {
rest: {
repos: {
getContent: jest.fn().mockReturnValue({data: externalConfig})
}
}
}
jest.mock('octokit', () => {
return {
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
Octokit: class {
constructor() {
return mockOctokit
}
}
}
})
beforeAll(() => {
jest.spyOn(Utils, 'isSPDXValid').mockReturnValue(true)
})