Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Abe27342 committed Jun 16, 2023
1 parent 0a7d2db commit cbabb42
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions packages/test/test-version-utils/src/testApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,10 @@ const DataRuntimeApi = {
},
};

async function loadLoader(
baseVersion: string,
requested?: number | string,
): Promise<typeof LoaderApi> {
async function loadLoader(baseVersion: string, requested?: number | string): Promise<void> {
const requestedStr = getRequestedRange(baseVersion, requested);
if (semver.satisfies(pkgVersion, requestedStr)) {
return LoaderApi;
return;
}

const { version, modulePath } = checkInstalled(requestedStr);
Expand All @@ -135,16 +132,15 @@ async function loadLoader(
};
loaderCache.set(version, loader);
}
return loaderCache.get(version) ?? throwNotFound("Loader", version);
}

async function loadContainerRuntime(
baseVersion: string,
requested?: number | string,
): Promise<typeof ContainerRuntimeApi> {
): Promise<void> {
const requestedStr = getRequestedRange(baseVersion, requested);
if (semver.satisfies(pkgVersion, requestedStr)) {
return ContainerRuntimeApi;
return;
}

const { version, modulePath } = checkInstalled(requestedStr);
Expand All @@ -159,16 +155,12 @@ async function loadContainerRuntime(
};
containerRuntimeCache.set(version, containerRuntime);
}
return containerRuntimeCache.get(version) ?? throwNotFound("ContainerRuntime", version);
}

async function loadDataRuntime(
baseVersion: string,
requested?: number | string,
): Promise<typeof DataRuntimeApi> {
async function loadDataRuntime(baseVersion: string, requested?: number | string): Promise<void> {
const requestedStr = getRequestedRange(baseVersion, requested);
if (semver.satisfies(pkgVersion, requestedStr)) {
return DataRuntimeApi;
return;
}
const { version, modulePath } = checkInstalled(requestedStr);
if (!dataRuntimeCache.has(version)) {
Expand Down Expand Up @@ -225,16 +217,12 @@ async function loadDataRuntime(
};
dataRuntimeCache.set(version, dataRuntime);
}
return dataRuntimeCache.get(version) ?? throwNotFound("DataRuntime", version);
}

async function loadDriver(
baseVersion: string,
requested?: number | string,
): Promise<typeof DriverApi> {
async function loadDriver(baseVersion: string, requested?: number | string): Promise<void> {
const requestedStr = getRequestedRange(baseVersion, requested);
if (semver.satisfies(pkgVersion, requestedStr)) {
return DriverApi;
return;
}

const { version, modulePath } = checkInstalled(requestedStr);
Expand Down Expand Up @@ -284,7 +272,6 @@ async function loadDriver(
RouterliciousDriverApi,
});
}
return driverCache.get(version) ?? throwNotFound("Driver", version);
}

function throwNotFound(layer: string, version: string): never {
Expand Down

0 comments on commit cbabb42

Please sign in to comment.