Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions packages/registry/src/definition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
compareSemver,
constructTag,
isExplicitVersionEntry,
isVersioned,
isZipVersionEntry,
listDefinitions,
loadDefinition,
resolveUrl,
Expand Down Expand Up @@ -481,11 +481,12 @@ versions:
expect(isVersioned(def)).toBe(true);
if (!isVersioned(def)) throw new Error("expected versioned");
expect(def.versions).toHaveLength(1);
expect(isZipVersionEntry(def.versions[0])).toBe(true);
if (isZipVersionEntry(def.versions[0])) {
expect(def.versions[0].versions).toEqual(["3.14", "3.13"]);
expect(def.versions[0].source.type).toBe("zip");
const entry = def.versions[0];
if (!entry || !isExplicitVersionEntry(entry)) {
throw new Error("expected explicit version entry");
}
expect(entry.versions).toEqual(["3.14", "3.13"]);
expect(entry.source.type).toBe("zip");
});

it("parses exclude_paths in zip source", () => {
Expand All @@ -511,12 +512,15 @@ versions:

expect(isVersioned(def)).toBe(true);
if (!isVersioned(def)) throw new Error("expected versioned");
if (isZipVersionEntry(def.versions[0])) {
expect(def.versions[0].source.exclude_paths).toEqual([
"whatsnew/**",
"changelog.html",
]);
const entry = def.versions[0];
if (!entry || !isExplicitVersionEntry(entry)) {
throw new Error("expected explicit version entry");
}
expect(entry.source.type).toBe("zip");
expect(entry.source.exclude_paths).toEqual([
"whatsnew/**",
"changelog.html",
]);
});

it("resolves zip version entry by exact match", () => {
Expand Down
7 changes: 0 additions & 7 deletions packages/registry/src/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@ export function isGitVersionEntry(
return "min_version" in entry;
}

/** Type guard for ZIP archive releases. */
export function isZipVersionEntry(
entry: VersionEntry,
): entry is ZipVersionEntry {
return entry.source.type === "zip";
}

/** Entries with an explicit release list, independent of package-manager APIs. */
export function isExplicitVersionEntry(
entry: VersionEntry,
Expand Down
3 changes: 1 addition & 2 deletions packages/registry/src/html-index-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { buildFromDefinition } from "./build.js";
import {
isExplicitVersionEntry,
isVersioned,
isZipVersionEntry,
loadDefinition,
resolveVersionEntry,
type VersionedDefinition,
Expand Down Expand Up @@ -64,7 +63,7 @@ describe("HTML index registry integration", () => {
expect(isVersioned(def)).toBe(true);
const entry = resolveVersionEntry(def as VersionedDefinition, "258");
expect(entry && isExplicitVersionEntry(entry)).toBe(true);
expect(entry && isZipVersionEntry(entry)).toBe(false);
expect(entry?.source.type).toBe("html-index");
expect(
resolveVersionEntry(def as VersionedDefinition, "257"),
).toBeUndefined();
Expand Down
1 change: 0 additions & 1 deletion packages/registry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export {
isExplicitVersionEntry,
isGitVersionEntry,
isVersioned,
isZipVersionEntry,
listDefinitions,
loadDefinition,
type PackageDefinition,
Expand Down
Loading