refactor: use Typescripts ReturnType<> instead of mocking all required properties

ping @JasonEtco - like that better?
This commit is contained in:
Gregor Martynus 2019-09-18 21:01:09 -07:00
parent 796a118c9b
commit bf5275d41f
1 changed files with 3 additions and 20 deletions

View File

@ -99,26 +99,9 @@ describe('Context', () => {
let github: GitHubAPI
function responseFromString (content: string) {
const data = {
content: Buffer.from(content).toString('base64'),
// add dummy properties to make response compatible with Typecsript definitions
_links: {
git: '',
html: '',
self: ''
},
download_url: '',
git_url: '',
html_url: '',
name: '',
path: '',
sha: '',
size: 1,
type: '',
url: ''
}
return createMockResponse(data)
return createMockResponse({
content: Buffer.from(content).toString('base64')
}) as ReturnType<typeof github.repos.getContents>
}
function responseFromConfig (fileName: string) {