Skip to content

Commit 4a3a064

Browse files
committed
chore: solve rate limits
1 parent c4c28f9 commit 4a3a064

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

tests/integration.test.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { existsSync } from 'fs'
22
import { readFile, rm } from 'fs/promises'
33
import { Agent } from 'https'
44
import { join } from 'path'
5+
import process from 'process'
56

7+
import { Headers } from 'node-fetch'
68
import { temporaryDirectory } from 'tempy'
79
import { beforeEach, describe, expect, test, vi } from 'vitest'
810

@@ -18,6 +20,12 @@ describe('integration', () => {
1820
vi.resetAllMocks()
1921
})
2022

23+
const headers = new Headers()
24+
25+
if (process.env.GITHUB_TOKEN) {
26+
headers.append('Authorization', `Bearer ${process.env.GITHUB_TOKEN}`)
27+
}
28+
2129
// Do as little tests as necessary here for now, as we run into GH rate limiting
2230

2331
test('should download simple file with custom agent', async () => {
@@ -29,7 +37,7 @@ describe('integration', () => {
2937
destination: tmpDir,
3038
extract: false,
3139
},
32-
{ agent: new Agent({ keepAlive: false }) },
40+
{ agent: new Agent({ keepAlive: false }), headers },
3341
)
3442

3543
const file = join(tmpDir, 'checksums.txt')
@@ -44,12 +52,15 @@ describe('integration', () => {
4452

4553
test('should download an archive and extract it', async () => {
4654
const tmpDir = temporaryDirectory()
47-
await fetchLatest({
48-
...baseRelease,
49-
package: 'live-tunnel-client-linux-386.tar.gz',
50-
destination: tmpDir,
51-
extract: true,
52-
})
55+
await fetchLatest(
56+
{
57+
...baseRelease,
58+
package: 'live-tunnel-client-linux-386.tar.gz',
59+
destination: tmpDir,
60+
extract: true,
61+
},
62+
{ headers },
63+
)
5364

5465
const file = join(tmpDir, 'live-tunnel-client')
5566

0 commit comments

Comments
 (0)