@@ -34,10 +34,22 @@ function versionNumber() {
34
34
const token = new Buffer ( "Y2Y5NDdhZDJhYzJlMzg1OGNiNzQzYzcwOWZhNGI0OTk2NWQ4ZDg3Yg==" , "base64" ) . toString ( )
35
35
const iconPath = join ( __dirname , ".." , "fixtures" , "test-app" , "build" , "icon.icns" )
36
36
37
- //test("GitHub unauthorized", async (t) => {
38
- // t.throws(await new GitHubPublisher("github-releases-test", "test-repo", versionNumber(), "incorrect token")
39
- // .releasePromise, /(Bad credentials|Unauthorized|API rate limit exceeded)/)
40
- //})
37
+ const publishContext : PublishContext = {
38
+ cancellationToken : new CancellationToken ( ) ,
39
+ progress : null ,
40
+ }
41
+
42
+ test ( "GitHub unauthorized" , async ( ) => {
43
+ try {
44
+ await new GitHubPublisher ( publishContext , { provider : "github" , owner : "actperepo" , repo : "ecb2" , token : "incorrect token" } , versionNumber ( ) ) . releasePromise
45
+ }
46
+ catch ( e ) {
47
+ expect ( e . message ) . toMatch ( / ( B a d c r e d e n t i a l s | U n a u t h o r i z e d | A P I r a t e l i m i t e x c e e d e d ) / )
48
+ return
49
+ }
50
+
51
+ throw new Error ( "must be error" )
52
+ } )
41
53
42
54
function isApiRateError ( e : Error ) : boolean {
43
55
if ( e . name === "HttpError" ) {
@@ -65,11 +77,6 @@ function testAndIgnoreApiRate(name: string, testFunction: () => Promise<any>) {
65
77
} )
66
78
}
67
79
68
- const publishContext : PublishContext = {
69
- cancellationToken : new CancellationToken ( ) ,
70
- progress : null ,
71
- }
72
-
73
80
test ( "Bintray upload" , async ( ) => {
74
81
const version = versionNumber ( )
75
82
0 commit comments