From 9d48e2ef7f637e070a7f55ac3ec7fa8b5c97cf36 Mon Sep 17 00:00:00 2001 From: Techatrix Date: Wed, 24 Jul 2024 20:46:43 +0200 Subject: [PATCH] rename select-zls-version response types --- src/select-zls-version.ts | 8 ++++---- test/select-zls-version.test.ts | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/select-zls-version.ts b/src/select-zls-version.ts index 1b6e6ad..c1f5593 100644 --- a/src/select-zls-version.ts +++ b/src/select-zls-version.ts @@ -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; @@ -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` */ @@ -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; @@ -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; diff --git a/test/select-zls-version.test.ts b/test/select-zls-version.test.ts index 645b9ab..3deccc1 100644 --- a/test/select-zls-version.test.ts +++ b/test/select-zls-version.test.ts @@ -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"; @@ -152,7 +152,7 @@ const samples: D2JsonData[] = [ async function selectZLSVersion( zigVersion: string, compatibility: VersionCompatibility, -): Promise { +): Promise { assert(compatibility != VersionCompatibility.None); const url = new URL("https://example.com/v1/select-zls-version"); url.searchParams.set("zig_version", zigVersion); @@ -280,7 +280,7 @@ describe("/v1/select-zls-version", () => { "https://example.com/v1/select-zls-version", ); const body = - await response.json(); + await response.json(); expect(Object.keys(body)).toStrictEqual([ "0.13.0", @@ -350,7 +350,7 @@ describe("/v1/select-zls-version", () => { "0.11.0", VersionCompatibility.Full, ); - expect(response).toStrictEqual({ + expect(response).toStrictEqual({ date: "1970-01-01", version: "0.11.0", "x86_64-linux": {