GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — t3code/scripts/merge-update-manifests.test.ts at main · AndryHTC/t3code

Expand file tree

/

merge-update-manifests.test.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
194 lines (173 loc) · 5.19 KB
/

merge-update-manifests.test.ts

Copy path

File metadata and controls

194 lines (173 loc) · 5.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, describe, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import { Command } from "effect/cli";
import {
mergePlatformUpdateManifests,
mergeUpdateManifestsCommand,
parsePlatformUpdateManifest,
serializePlatformUpdateManifest,
} from "./merge-update-manifests.ts";
const runCli = Command.runWith(mergeUpdateManifestsCommand, { version: "0.0.0" });
describe("merge-update-manifests", () => {
it("merges arm64 and x64 macOS update manifests into one multi-arch manifest", () => {
const arm64 = parsePlatformUpdateManifest(
"mac",
`version: 0.0.4
files:
- url: T3-Code-0.0.4-arm64.zip
sha512: arm64zip
size: 125621344
- url: T3-Code-0.0.4-arm64.dmg
sha512: arm64dmg
size: 131754935
path: T3-Code-0.0.4-arm64.zip
sha512: arm64zip
releaseDate: '2026-03-07T10:32:14.587Z'
`,
"latest-mac.yml",
);
const x64 = parsePlatformUpdateManifest(
"mac",
`version: 0.0.4
files:
- url: T3-Code-0.0.4-x64.zip
sha512: x64zip
size: 132000112
- url: T3-Code-0.0.4-x64.dmg
sha512: x64dmg
size: 138148807
path: T3-Code-0.0.4-x64.zip
sha512: x64zip
releaseDate: '2026-03-07T10:36:07.540Z'
`,
"latest-mac-x64.yml",
);
const merged = mergePlatformUpdateManifests("mac", arm64, x64);
assert.equal(merged.version, "0.0.4");
assert.equal(merged.releaseDate, "2026-03-07T10:36:07.540Z");
assert.deepStrictEqual(
merged.files.map((file) => file.url),
[
"T3-Code-0.0.4-arm64.zip",
"T3-Code-0.0.4-arm64.dmg",
"T3-Code-0.0.4-x64.zip",
"T3-Code-0.0.4-x64.dmg",
],
);
const serialized = serializePlatformUpdateManifest("mac", merged);
assert.ok(!serialized.includes("path:"));
assert.equal((serialized.match(/- url:/g) ?? []).length, 4);
});
it("rejects mismatched manifest versions", () => {
const primary = parsePlatformUpdateManifest(
"win",
`version: 0.0.4
files:
- url: T3-Code-0.0.4-arm64.exe
sha512: arm64exe
size: 1
releaseDate: '2026-03-07T10:32:14.587Z'
`,
"latest-win-arm64.yml",
);
const secondary = parsePlatformUpdateManifest(
"win",
`version: 0.0.5
files:
- url: T3-Code-0.0.5-x64.exe
sha512: x64exe
size: 1
releaseDate: '2026-03-07T10:36:07.540Z'
`,
"latest-win-x64.yml",
);
assert.throws(
() => mergePlatformUpdateManifests("win", primary, secondary),
/different versions/,
);
});
it("preserves quoted scalars as strings", () => {
const manifest = parsePlatformUpdateManifest(
"mac",
`version: '1.0'
files:
- url: T3-Code-1.0-x64.zip
sha512: zipsha
size: 1
releaseName: 'true'
minimumSystemVersion: '13.0'
stagingPercentage: 50
releaseDate: '2026-03-07T10:36:07.540Z'
`,
"latest-mac.yml",
);
assert.equal(manifest.version, "1.0");
assert.equal(manifest.extras.releaseName, "true");
assert.equal(manifest.extras.minimumSystemVersion, "13.0");
assert.equal(manifest.extras.stagingPercentage, 50);
});
it("round-trips numeric-looking versions as strings", () => {
const original = parsePlatformUpdateManifest(
"win",
`version: '1.0'
files:
- url: T3-Code-1.0-x64.exe
sha512: exesha
size: 1
releaseDate: '2026-03-07T10:36:07.540Z'
`,
"latest-win-x64.yml",
);
const serialized = serializePlatformUpdateManifest("win", original);
assert.ok(serialized.includes("version: '1.0'"));
const reparsed = parsePlatformUpdateManifest("win", serialized, "latest-win-x64.yml");
assert.equal(reparsed.version, "1.0");
});
});
it.layer(NodeServices.layer)("merge-update-manifests cli", (it) => {
const arm64MacManifest = `version: 0.0.4
files:
- url: T3-Code-0.0.4-arm64.zip
sha512: arm64zip
size: 125621344
- url: T3-Code-0.0.4-arm64.dmg
sha512: arm64dmg
size: 131754935
path: T3-Code-0.0.4-arm64.zip
sha512: arm64zip
releaseDate: '2026-03-07T10:32:14.587Z'
`;
const x64MacManifest = `version: 0.0.4
files:
- url: T3-Code-0.0.4-x64.zip
sha512: x64zip
size: 132000112
- url: T3-Code-0.0.4-x64.dmg
sha512: x64dmg
size: 138148807
path: T3-Code-0.0.4-x64.zip
sha512: x64zip
releaseDate: '2026-03-07T10:36:07.540Z'
`;
it.effect("writes the merged manifest back to the primary path by default", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const baseDir = yield* fs.makeTempDirectoryScoped({
prefix: "merge-update-manifests-cli-",
});
const primaryPath = path.join(baseDir, "latest-mac.yml");
const secondaryPath = path.join(baseDir, "latest-mac-x64.yml");
yield* fs.writeFileString(primaryPath, arm64MacManifest);
yield* fs.writeFileString(secondaryPath, x64MacManifest);
yield* runCli(["--platform", "mac", primaryPath, secondaryPath]);
const merged = yield* fs.readFileString(primaryPath);
assert.ok(merged.includes("T3-Code-0.0.4-arm64.zip"));
assert.ok(merged.includes("T3-Code-0.0.4-x64.zip"));
assert.ok(!merged.includes("path:"));
}),
);
});
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.