Skip to content

Commit da63717

Browse files
committed
test: provide a mock implementation of Octokit
This avoids the new error when running the tests: TypeError: rest_1.Octokit is not a constructor Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 203f57f commit da63717

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

__mocks__/@octokit/rest.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module.exports = {
2+
__esModule: true,
3+
Octokit: jest.fn().mockImplementation(() => {
4+
return {
5+
actions: {
6+
listWorkflowRuns: jest.fn().mockResolvedValue({
7+
data: {
8+
workflow_runs: [
9+
{
10+
head_sha: 'mock_sha'
11+
}
12+
]
13+
}
14+
}),
15+
listWorkflowRunArtifacts: jest.fn().mockResolvedValue({
16+
data: {
17+
artifacts: [
18+
{
19+
name: 'git-sdk-64-build-installers',
20+
id: 12345,
21+
created_at: '2025-08-12T12:00:00Z'
22+
}
23+
]
24+
}
25+
}),
26+
downloadArtifact: jest.fn().mockResolvedValue({
27+
data: 'mock artifact content'
28+
})
29+
},
30+
repos: {
31+
getBranch: jest.fn().mockResolvedValue({
32+
data: {
33+
commit: {
34+
sha: 'mock_sha'
35+
}
36+
}
37+
}),
38+
listReleases: jest.fn().mockResolvedValue({
39+
data: [
40+
{
41+
tag_name: 'v2.41.0.windows.1',
42+
assets: [
43+
{
44+
name: 'git-sdk-64-build-installers.7z',
45+
browser_download_url: 'https://example.com/git-sdk-64-build-installers.7z'
46+
}
47+
]
48+
}
49+
]
50+
})
51+
}
52+
}
53+
})
54+
}

0 commit comments

Comments
 (0)