-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(types): add TS validation to assure types are properly configured
- Loading branch information
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Octokit } from "@octokit/core"; | ||
import { throttling } from "../src/index"; | ||
// ************************************************************ | ||
// THIS CODE IS NOT EXECUTED. IT IS FOR TYPECHECKING ONLY | ||
// ************************************************************ | ||
|
||
const octokit = new Octokit(); | ||
|
||
// will be deprecated soon | ||
// onAbuseLimit() | ||
throttling(octokit, { | ||
throttle: { enabled: true, onRateLimit: () => {}, onAbuseLimit: () => {} }, | ||
}); | ||
|
||
// onSecondaryLimit() | ||
throttling(octokit, { | ||
throttle: { | ||
enabled: true, | ||
onRateLimit: () => {}, | ||
onSecondaryRateLimit: () => {}, | ||
}, | ||
}); | ||
|
||
// onSecondaryLimit() and onAbuseLimit() should be a TS Error | ||
// @ts-expect-error | ||
throttling(octokit, { | ||
throttle: { | ||
enabled: true, | ||
onRateLimit: () => {}, | ||
onSecondaryRateLimit: () => {}, | ||
onAbuseLimit: () => {}, | ||
}, | ||
}); | ||
|
||
// onRateLimit() missing should be a TS Error | ||
// @ts-expect-error | ||
throttling(octokit, { | ||
throttle: { | ||
enabled: true, | ||
onSecondaryRateLimit: () => {}, | ||
}, | ||
}); | ||
|
||
// onSecondaryLimit() and onAbuseLimit() missing should be a TS Error | ||
throttling(octokit, { | ||
// @ts-expect-error | ||
throttle: { | ||
enabled: true, | ||
onRateLimit: () => {}, | ||
}, | ||
}); |