|
1 | 1 | import { assertEquals } from "./deps.test.ts"; |
2 | 2 | import { pluginResolvers, tryResolveLatestJson, tryResolvePluginUrl, tryResolveSchemaUrl } from "./plugins.ts"; |
3 | | -import { getLatestReleaseTagName } from "./utils/mod.ts"; |
| 3 | +import { getLatestReleaseInfo } from "./utils/mod.ts"; |
4 | 4 |
|
5 | 5 | Deno.test("should get correct info for typescript resolver", () => { |
6 | 6 | const resolver = getResolverByName("typescript"); |
@@ -226,39 +226,59 @@ Deno.test("tryResolveUserLatestJson", async () => { |
226 | 226 | // dprint repo |
227 | 227 | { |
228 | 228 | const result = await getValidResultForUrl("https://plugins.dprint.dev/dprint/typescript/latest.json"); |
229 | | - const tagName = await getLatestReleaseTagName("dprint", "dprint-plugin-typescript"); |
| 229 | + const releaseInfo = await getLatestReleaseInfo("dprint", "dprint-plugin-typescript"); |
230 | 230 | assertEquals(result, { |
231 | 231 | schemaVersion: 1, |
232 | | - url: `https://plugins.dprint.dev/typescript-${tagName!}.wasm`, |
| 232 | + url: `https://plugins.dprint.dev/typescript-${releaseInfo!.tagName}.wasm`, |
| 233 | + version: releaseInfo!.tagName, |
| 234 | + checksum: undefined, |
233 | 235 | }); |
234 | 236 | } |
235 | 237 | // dprint repo full name |
236 | 238 | { |
237 | 239 | const result = await getValidResultForUrl( |
238 | 240 | "https://plugins.dprint.dev/dprint/dprint-plugin-typescript/latest.json", |
239 | 241 | ); |
240 | | - const tagName = await getLatestReleaseTagName("dprint", "dprint-plugin-typescript"); |
| 242 | + const releaseInfo = await getLatestReleaseInfo("dprint", "dprint-plugin-typescript"); |
241 | 243 | assertEquals(result, { |
242 | 244 | schemaVersion: 1, |
243 | | - url: `https://plugins.dprint.dev/typescript-${tagName!}.wasm`, |
| 245 | + url: `https://plugins.dprint.dev/typescript-${releaseInfo!.tagName}.wasm`, |
| 246 | + version: releaseInfo!.tagName, |
| 247 | + checksum: undefined, |
244 | 248 | }); |
245 | 249 | } |
246 | 250 | // non-dprint repo |
247 | 251 | { |
248 | 252 | const result = await getValidResultForUrl("https://plugins.dprint.dev/malobre/vue/latest.json"); |
249 | | - const tagName = await getLatestReleaseTagName("malobre", "dprint-plugin-vue"); |
| 253 | + const releaseInfo = await getLatestReleaseInfo("malobre", "dprint-plugin-vue"); |
250 | 254 | assertEquals(result, { |
251 | 255 | schemaVersion: 1, |
252 | | - url: `https://plugins.dprint.dev/malobre/vue-${tagName!}.wasm`, |
| 256 | + url: `https://plugins.dprint.dev/malobre/vue-${releaseInfo!.tagName}.wasm`, |
| 257 | + version: releaseInfo!.tagName.replace(/^v/, ""), |
| 258 | + checksum: undefined, |
253 | 259 | }); |
254 | 260 | } |
255 | 261 | // non-dprint repo full name |
256 | 262 | { |
257 | 263 | const result = await getValidResultForUrl("https://plugins.dprint.dev/malobre/dprint-plugin-vue/latest.json"); |
258 | | - const tagName = await getLatestReleaseTagName("malobre", "dprint-plugin-vue"); |
| 264 | + const releaseInfo = await getLatestReleaseInfo("malobre", "dprint-plugin-vue"); |
259 | 265 | assertEquals(result, { |
260 | 266 | schemaVersion: 1, |
261 | | - url: `https://plugins.dprint.dev/malobre/vue-${tagName!}.wasm`, |
| 267 | + url: `https://plugins.dprint.dev/malobre/vue-${releaseInfo!.tagName}.wasm`, |
| 268 | + version: releaseInfo!.tagName.replace(/^v/, ""), |
| 269 | + checksum: undefined, |
| 270 | + }); |
| 271 | + } |
| 272 | + // process plugin repo |
| 273 | + { |
| 274 | + const result = await getValidResultForUrl("https://plugins.dprint.dev/dprint/prettier/latest.json"); |
| 275 | + const releaseInfo = await getLatestReleaseInfo("dprint", "dprint-plugin-prettier"); |
| 276 | + assertEquals(releaseInfo?.checksum?.length, 64); |
| 277 | + assertEquals(result, { |
| 278 | + schemaVersion: 1, |
| 279 | + url: `https://plugins.dprint.dev/prettier-${releaseInfo!.tagName}.exe-plugin`, |
| 280 | + version: releaseInfo!.tagName, |
| 281 | + checksum: releaseInfo!.checksum, |
262 | 282 | }); |
263 | 283 | } |
264 | 284 |
|
|
0 commit comments