File tree 4 files changed +15
-5
lines changed
4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ for (const compressionType of Object.values(CompressionType)) {
10
10
token : process . env . GIST_TOKEN ,
11
11
compression : compressionType
12
12
} )
13
- await db . init ( )
14
13
} )
15
14
afterAll ( async ( ) => {
16
15
await db . destroy ( )
@@ -68,7 +67,7 @@ for (const compressionType of Object.values(CompressionType)) {
68
67
) ) as GistResponse
69
68
70
69
expect ( found ) . toEqual ( { } )
71
- } , 30000 )
70
+ } )
72
71
it ( 'gets and deletes many' , async ( ) => {
73
72
await db . set ( 'test_many_one' , { } )
74
73
await db . set ( 'test_many_two' , { } )
@@ -83,7 +82,7 @@ for (const compressionType of Object.values(CompressionType)) {
83
82
undefined ,
84
83
undefined
85
84
] )
86
- } , 30000 )
85
+ } )
87
86
} )
88
87
}
89
88
Original file line number Diff line number Diff line change 13
13
"useESM" : true
14
14
}
15
15
]
16
- }
16
+ },
17
+ "testTimeout" : 60000
17
18
}
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export class GistDatabase {
55
55
public static MAX_FILE_SIZE_BYTES = 999999 // 0.99mb
56
56
public static MAX_FILES_PER_GIST = 10
57
57
public isNewDatabase : boolean
58
+ public initialized : boolean = false
58
59
59
60
constructor ( options : GistDatabaseOptions ) {
60
61
this . options = {
@@ -98,10 +99,18 @@ export class GistDatabase {
98
99
this . isNewDatabase = false
99
100
this . options . id = gist . id
100
101
}
102
+ this . initialized = true
101
103
return gist
102
104
}
103
105
106
+ private async initIfNeeded ( ) {
107
+ if ( ! this . initialized ) {
108
+ await this . init ( )
109
+ }
110
+ }
111
+
104
112
public async getRoot ( ) : Promise < GistResponse > {
113
+ await this . initIfNeeded ( )
105
114
return ( await this . gistApi (
106
115
`/gists/${ this . options . id } ` ,
107
116
'GET'
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ const main = async () => {
21
21
22
22
console . log ( {
23
23
id : res . id ,
24
- url : res . url ,
24
+ rawUrl : res . url ,
25
+ url : `https://gist.github.com/${ res . id } ` ,
25
26
public : isPublic ,
26
27
description : process . argv [ 3 ]
27
28
} )
You can’t perform that action at this time.
0 commit comments