Skip to content

Commit e9baf77

Browse files
committed
[ fix ] Recongnize WASM ALS downloads in the version switching UI
1 parent de3f163 commit e9baf77

File tree

4 files changed

+152
-1
lines changed

4 files changed

+152
-1
lines changed

lib/js/src/State/State__SwitchVersion.bs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__State__SwitchVersion.bs.js

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/State/State__SwitchVersion.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ module SwitchVersionManager = {
307307
->String.replace(".exe", "")
308308
->String.replace(".cmd", "")
309309
->String.replace(".bat", "")
310+
->String.replace(".wasm", "")
310311

311312
if cleanName == "agda" || cleanName->String.startsWith("agda-") {
312313
Memento.Endpoints.Agda(None)

test/tests/Test__State__SwitchVersion.res

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,103 @@ describe("State__SwitchVersion", () => {
144144
)
145145
},
146146
)
147+
148+
describe(
149+
"inferEndpointType",
150+
() => {
151+
it(
152+
"should recognize als.wasm as ALS endpoint",
153+
() => {
154+
Assert.deepStrictEqual(
155+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("als.wasm"),
156+
Memento.Endpoints.ALS(None),
157+
)
158+
},
159+
)
160+
161+
it(
162+
"should recognize als as ALS endpoint",
163+
() => {
164+
Assert.deepStrictEqual(
165+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("als"),
166+
Memento.Endpoints.ALS(None),
167+
)
168+
},
169+
)
170+
171+
it(
172+
"should recognize als.exe as ALS endpoint",
173+
() => {
174+
Assert.deepStrictEqual(
175+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("als.exe"),
176+
Memento.Endpoints.ALS(None),
177+
)
178+
},
179+
)
180+
181+
it(
182+
"should recognize agda as Agda endpoint",
183+
() => {
184+
Assert.deepStrictEqual(
185+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("agda"),
186+
Memento.Endpoints.Agda(None),
187+
)
188+
},
189+
)
190+
191+
it(
192+
"should recognize agda-2.6.4 as Agda endpoint",
193+
() => {
194+
Assert.deepStrictEqual(
195+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("agda-2.6.4"),
196+
Memento.Endpoints.Agda(None),
197+
)
198+
},
199+
)
200+
201+
it(
202+
"should recognize unknown executables",
203+
() => {
204+
Assert.deepStrictEqual(
205+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("unknown"),
206+
Memento.Endpoints.Unknown,
207+
)
208+
},
209+
)
210+
211+
it(
212+
"should extract basename from full paths",
213+
() => {
214+
Assert.deepStrictEqual(
215+
State__SwitchVersion.SwitchVersionManager.inferEndpointType(
216+
"/path/to/dev-als/als.wasm",
217+
),
218+
Memento.Endpoints.ALS(None),
219+
)
220+
},
221+
)
222+
223+
it(
224+
"should handle uppercase extensions",
225+
() => {
226+
Assert.deepStrictEqual(
227+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("ALS.WASM"),
228+
Memento.Endpoints.ALS(None),
229+
)
230+
},
231+
)
232+
233+
it(
234+
"should recognize als- prefixed executables",
235+
() => {
236+
Assert.deepStrictEqual(
237+
State__SwitchVersion.SwitchVersionManager.inferEndpointType("als-server"),
238+
Memento.Endpoints.ALS(None),
239+
)
240+
},
241+
)
242+
},
243+
)
147244
})
148245

149246
describe("QuickPick", () => {

0 commit comments

Comments
 (0)