Skip to content

Commit

Permalink
assert length of file shasum
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Aug 6, 2024
1 parent 68b8c57 commit 4a3568a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/select-zls-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function artifactsToRecord(
break;
}
assert(!(`${artifact.arch}-${artifact.os}` in targets));
assert.strictEqual(artifact.fileShasum.length, 64);
targets[`${artifact.arch}-${artifact.os}`] = {
tarball: `${env.R2_PUBLIC_URL}/zls-${artifact.os}-${artifact.arch}-${artifact.version}.${artifact.extension}`,
shasum: artifact.fileShasum,
Expand Down
39 changes: 26 additions & 13 deletions test/select-zls-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@ const defaultArtifacts: ReleaseArtifact[] = [
os: "linux",
version: "0.11.0",
extension: "tar.xz",
fileShasum: "aaa",
fileShasum:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
fileSize: 12,
},
{
arch: "x86_64",
os: "linux",
version: "0.11.0",
extension: "tar.gz",
fileShasum: "bbb",
fileShasum:
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
fileSize: 12,
},
{
arch: "aarch64",
os: "windows",
version: "0.11.0",
extension: "zip",
fileShasum: "ccc",
fileShasum:
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
fileSize: 12,
},
];
Expand Down Expand Up @@ -247,51 +250,59 @@ describe("/v1/zls/index.json", () => {
date: "1970-01-01",
"x86_64-linux": {
tarball: `${env.R2_PUBLIC_URL}/zls-linux-x86_64-0.11.0.tar.xz`,
shasum: "aaa",
shasum:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
size: "12",
},
"aarch64-windows": {
tarball: `${env.R2_PUBLIC_URL}/zls-windows-aarch64-0.11.0.zip`,
shasum: "ccc",
shasum:
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
size: "12",
},
},
"0.12.0": {
date: "1970-01-01",
"x86_64-linux": {
tarball: `${env.R2_PUBLIC_URL}/zls-linux-x86_64-0.11.0.tar.xz`,
shasum: "aaa",
shasum:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
size: "12",
},
"aarch64-windows": {
tarball: `${env.R2_PUBLIC_URL}/zls-windows-aarch64-0.11.0.zip`,
shasum: "ccc",
shasum:
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
size: "12",
},
},
"0.12.1": {
date: "1970-01-01",
"x86_64-linux": {
tarball: `${env.R2_PUBLIC_URL}/zls-linux-x86_64-0.11.0.tar.xz`,
shasum: "aaa",
shasum:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
size: "12",
},
"aarch64-windows": {
tarball: `${env.R2_PUBLIC_URL}/zls-windows-aarch64-0.11.0.zip`,
shasum: "ccc",
shasum:
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
size: "12",
},
},
"0.13.0": {
date: "1970-01-01",
"x86_64-linux": {
tarball: `${env.R2_PUBLIC_URL}/zls-linux-x86_64-0.11.0.tar.xz`,
shasum: "aaa",
shasum:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
size: "12",
},
"aarch64-windows": {
tarball: `${env.R2_PUBLIC_URL}/zls-windows-aarch64-0.11.0.zip`,
shasum: "ccc",
shasum:
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
size: "12",
},
},
Expand Down Expand Up @@ -417,12 +428,14 @@ describe("/v1/zls/select-version", () => {
version: "0.11.0",
"x86_64-linux": {
tarball: `${env.R2_PUBLIC_URL}/zls-linux-x86_64-0.11.0.tar.xz`,
shasum: "aaa",
shasum:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
size: "12",
},
"aarch64-windows": {
tarball: `${env.R2_PUBLIC_URL}/zls-windows-aarch64-0.11.0.zip`,
shasum: "ccc",
shasum:
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
size: "12",
},
});
Expand Down

0 comments on commit 4a3568a

Please sign in to comment.