Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use nock for preset tests (#6449)
- Loading branch information
Showing
9 changed files
with
469 additions
and
143 deletions.
There are no files selected for viewing
189 changes: 188 additions & 1 deletion
189
lib/config/presets/github/__snapshots__/index.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,194 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`config/presets/github fetchJSONFile() returns JSON 1`] = ` | ||
exports[`config/presets/github/index fetchJSONFile() returns JSON 1`] = ` | ||
Object { | ||
"from": "api", | ||
} | ||
`; | ||
|
||
exports[`config/presets/github/index fetchJSONFile() returns JSON 2`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/some-filename.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() should query preset within the file 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/somefile.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() should query subpreset 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/somefile.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() should return custom.json 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.machine-man-preview+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/custom.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() should return default.json 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/default.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() should return undefined 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.machine-man-preview+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/somefile.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() throws if fails to parse 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/default.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() throws if no content 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/default.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPreset() tries default then renovate 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/default.json", | ||
}, | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/renovate.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPresetFromEndpoint() uses custom endpoint 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.example.org", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.example.org/repos/some/repo/contents/default.json", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`config/presets/github/index getPresetFromEndpoint() uses default endpoint 1`] = ` | ||
Array [ | ||
Object { | ||
"headers": Object { | ||
"accept": "application/vnd.github.v3+json", | ||
"accept-encoding": "gzip, deflate", | ||
"authorization": "token abc", | ||
"host": "api.github.com", | ||
"user-agent": "https://github.com/renovatebot/renovate", | ||
}, | ||
"method": "GET", | ||
"url": "https://api.github.com/repos/some/repo/contents/default.json", | ||
}, | ||
] | ||
`; |
Oops, something went wrong.