@@ -16,19 +16,19 @@ import * as installer from "../src/installer";
16
16
17
17
describe("filename tests", () => {
18
18
const tests = [
19
- ["protoc-3.20 .2-linux-x86_32.zip", "linux", ""],
20
- ["protoc-3.20 .2-linux-x86_64.zip", "linux", "x64"],
21
- ["protoc-3.20 .2-linux-aarch_64.zip", "linux", "arm64"],
22
- ["protoc-3.20 .2-linux-ppcle_64.zip", "linux", "ppc64"],
23
- ["protoc-3.20 .2-linux-s390_64.zip", "linux", "s390x"],
24
- ["protoc-3.20 .2-osx-aarch_64.zip", "darwin", "arm64"],
25
- ["protoc-3.20 .2-osx-x86_64.zip", "darwin", "x64"],
26
- ["protoc-3.20 .2-win64.zip", "win32", "x64"],
27
- ["protoc-3.20. 2-win32.zip", "win32", "x32"],
19
+ ["protoc-23 .2-linux-x86_32.zip", "linux", ""],
20
+ ["protoc-23 .2-linux-x86_64.zip", "linux", "x64"],
21
+ ["protoc-23 .2-linux-aarch_64.zip", "linux", "arm64"],
22
+ ["protoc-23 .2-linux-ppcle_64.zip", "linux", "ppc64"],
23
+ ["protoc-23 .2-linux-s390_64.zip", "linux", "s390x"],
24
+ ["protoc-23 .2-osx-aarch_64.zip", "darwin", "arm64"],
25
+ ["protoc-23 .2-osx-x86_64.zip", "darwin", "x64"],
26
+ ["protoc-23 .2-win64.zip", "win32", "x64"],
27
+ ["protoc-23. 2-win32.zip", "win32", "x32"]
28
28
];
29
29
it(`Downloads all expected versions correctly`, () => {
30
30
for (const [expected, plat, arch] of tests) {
31
- const actual = installer.getFileName("3.20 .2", plat, arch);
31
+ const actual = installer.getFileName("23 .2", plat, arch);
32
32
expect(expected).toBe(actual);
33
33
}
34
34
});
@@ -52,8 +52,8 @@ describe("installer tests", () => {
52
52
});
53
53
54
54
it("Downloads version of protoc if no matching version is installed", async () => {
55
- await installer.getProtoc("3.9 .0", true, GITHUB_TOKEN);
56
- const protocDir = path.join(toolDir, "protoc", "3.9 .0", os.arch());
55
+ await installer.getProtoc("v23 .0", true, GITHUB_TOKEN);
56
+ const protocDir = path.join(toolDir, "protoc", "v23 .0", os.arch());
57
57
58
58
expect(fs.existsSync(`${protocDir}.complete`)).toBe(true);
59
59
@@ -79,30 +79,28 @@ describe("installer tests", () => {
79
79
nock("https://api.github.com")
80
80
.get("/repos/protocolbuffers/protobuf/releases?page=3")
81
81
.replyWithFile(200, path.join(dataDir, "releases-3.json"));
82
+
83
+ nock("https://api.github.com")
84
+ .get("/repos/protocolbuffers/protobuf/releases?page=4")
85
+ .replyWithFile(200, path.join(dataDir, "releases-4.json"));
86
+
87
+ nock("https://api.github.com")
88
+ .get("/repos/protocolbuffers/protobuf/releases?page=5")
89
+ .replyWithFile(200, path.join(dataDir, "releases-5.json"));
90
+
91
+ nock("https://api.github.com")
92
+ .get("/repos/protocolbuffers/protobuf/releases?page=6")
93
+ .replyWithFile(200, path.join(dataDir, "releases-6.json"));
82
94
});
83
95
84
96
afterEach(() => {
85
97
nock.cleanAll();
86
98
nock.enableNetConnect();
87
99
});
88
100
89
- it("Gets the latest 3.7.x version of protoc using 3.7 and no matching version is installed", async () => {
90
- await installer.getProtoc("3.7", true, GITHUB_TOKEN);
91
- const protocDir = path.join(toolDir, "protoc", "3.7.1", os.arch());
92
-
93
- expect(fs.existsSync(`${protocDir}.complete`)).toBe(true);
94
- if (IS_WINDOWS) {
95
- expect(fs.existsSync(path.join(protocDir, "bin", "protoc.exe"))).toBe(
96
- true
97
- );
98
- } else {
99
- expect(fs.existsSync(path.join(protocDir, "bin", "protoc"))).toBe(true);
100
- }
101
- }, 100000);
102
-
103
- it("Gets latest version of protoc using 3.x and no matching version is installed", async () => {
104
- await installer.getProtoc("3.x", true, GITHUB_TOKEN);
105
- const protocDir = path.join(toolDir, "protoc", "3.12.4", os.arch());
101
+ it("Gets the latest v23.1 version of protoc using v23.1 and no matching version is installed", async () => {
102
+ await installer.getProtoc("v23.1", true, GITHUB_TOKEN);
103
+ const protocDir = path.join(toolDir, "protoc", "v23.1", os.arch());
106
104
107
105
expect(fs.existsSync(`${protocDir}.complete`)).toBe(true);
108
106
if (IS_WINDOWS) {
@@ -113,31 +111,10 @@ describe("installer tests", () => {
113
111
expect(fs.existsSync(path.join(protocDir, "bin", "protoc"))).toBe(true);
114
112
}
115
113
}, 100000);
116
- });
117
-
118
- describe("Gets the latest release of protoc with broken latest rc tag", () => {
119
- beforeEach(() => {
120
- nock("https://api.github.com")
121
- .get("/repos/protocolbuffers/protobuf/releases?page=1")
122
- .replyWithFile(200, path.join(dataDir, "releases-broken-rc-tag.json"));
123
-
124
- nock("https://api.github.com")
125
- .get("/repos/protocolbuffers/protobuf/releases?page=2")
126
- .replyWithFile(200, path.join(dataDir, "releases-2.json"));
127
-
128
- nock("https://api.github.com")
129
- .get("/repos/protocolbuffers/protobuf/releases?page=3")
130
- .replyWithFile(200, path.join(dataDir, "releases-3.json"));
131
- });
132
-
133
- afterEach(() => {
134
- nock.cleanAll();
135
- nock.enableNetConnect();
136
- });
137
114
138
- it("Gets latest version of protoc using 3 .x with a broken rc tag, filtering pre-releases ", async () => {
139
- await installer.getProtoc("3 .x", false, "" );
140
- const protocDir = path.join(toolDir, "protoc", "3.9.1 ", os.arch());
115
+ it("Gets latest version of protoc using v22 .x and no matching version is installed ", async () => {
116
+ await installer.getProtoc("v22 .x", true, GITHUB_TOKEN );
117
+ const protocDir = path.join(toolDir, "protoc", "v22.5 ", os.arch());
141
118
142
119
expect(fs.existsSync(`${protocDir}.complete`)).toBe(true);
143
120
if (IS_WINDOWS) {
0 commit comments