Skip to content

Commit

Permalink
rename select-zls-version response types
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Jul 24, 2024
1 parent 87d2af3 commit 9d48e2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/select-zls-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { D2JsonData, ReleaseArtifact, VersionCompatibility } from "./shared";
/**
* Similar to https://ziglang.org/download/index.json
*/
export type SelectZLSVersionWithVersionResponse =
export type SelectZLSVersionWithZigVersionResponse =
| {
/** The ZLS version */
version: string;
Expand All @@ -19,7 +19,7 @@ export type SelectZLSVersionWithVersionResponse =
/**
* Similar to https://ziglang.org/download/index.json
*/
export type SelectZLSVersionWithoutVersionResponse = Record<
export type SelectZLSVersionWithoutZigVersionResponse = Record<
string,
{
/** `YYYY-MM-DD` */
Expand Down Expand Up @@ -84,7 +84,7 @@ export async function handleSelectZLSVersion(
"SELECT JsonData FROM ZLSReleases WHERE IsRelease = 1 ORDER BY ZLSVersionMajor DESC, ZLSVersionMinor DESC, ZLSVersionPatch DESC",
).all<{ JsonData: string }>();

const response: SelectZLSVersionWithoutVersionResponse = {};
const response: SelectZLSVersionWithoutZigVersionResponse = {};

for (const entry of result.results) {
const jsonData = JSON.parse(entry.JsonData) as D2JsonData;
Expand Down Expand Up @@ -138,7 +138,7 @@ export async function handleSelectZLSVersion(
? await selectOnTaggedRelease(env, zigVersion)
: await selectOnDevelopmentBuild(env, zigVersion, compatibility);

let response: SelectZLSVersionWithVersionResponse;
let response: SelectZLSVersionWithZigVersionResponse;

if ("error" in selectedVersion) {
response = selectedVersion;
Expand Down
10 changes: 5 additions & 5 deletions test/select-zls-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
} from "../src/shared";
import {
handleSelectZLSVersion,
SelectZLSVersionWithoutVersionResponse,
SelectZLSVersionWithVersionResponse,
SelectZLSVersionWithoutZigVersionResponse,
SelectZLSVersionWithZigVersionResponse,
} from "../src/select-zls-version";
import { SemanticVersion } from "../src/semantic-version";

Expand Down Expand Up @@ -152,7 +152,7 @@ const samples: D2JsonData[] = [
async function selectZLSVersion(
zigVersion: string,
compatibility: VersionCompatibility,
): Promise<SelectZLSVersionWithVersionResponse> {
): Promise<SelectZLSVersionWithZigVersionResponse> {
assert(compatibility != VersionCompatibility.None);
const url = new URL("https://example.com/v1/select-zls-version");
url.searchParams.set("zig_version", zigVersion);
Expand Down Expand Up @@ -280,7 +280,7 @@ describe("/v1/select-zls-version", () => {
"https://example.com/v1/select-zls-version",
);
const body =
await response.json<SelectZLSVersionWithoutVersionResponse>();
await response.json<SelectZLSVersionWithoutZigVersionResponse>();

expect(Object.keys(body)).toStrictEqual([
"0.13.0",
Expand Down Expand Up @@ -350,7 +350,7 @@ describe("/v1/select-zls-version", () => {
"0.11.0",
VersionCompatibility.Full,
);
expect(response).toStrictEqual<SelectZLSVersionWithVersionResponse>({
expect(response).toStrictEqual<SelectZLSVersionWithZigVersionResponse>({
date: "1970-01-01",
version: "0.11.0",
"x86_64-linux": {
Expand Down

0 comments on commit 9d48e2e

Please sign in to comment.