test: consolidate failure guards and trim unused fixture APIs
This commit is contained in:
@@ -2,7 +2,6 @@ import { writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { TextReader, Uint8ArrayWriter, ZipWriter } from "@zip.js/zip.js";
|
||||
import { expect } from "vitest";
|
||||
|
||||
import { runProviderAnalysis } from "../../src/composition/directAnalysis.js";
|
||||
import type { AnalysisError } from "../../src/domain/analysisErrorBase.js";
|
||||
@@ -14,7 +13,6 @@ import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
|
||||
export const requireSuccessfulProjection = (
|
||||
result: Result<Evidence, AnalysisError>,
|
||||
): Evidence => {
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok)
|
||||
throw new TypeError("Expected application projection to succeed");
|
||||
return result.value;
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
realpath,
|
||||
rm,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
||||
|
||||
@@ -13,12 +6,9 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
||||
export interface TestWorkspace {
|
||||
readonly root: string;
|
||||
readonly home: string;
|
||||
readonly xdgConfigHome: string;
|
||||
readonly xdgCacheHome: string;
|
||||
readonly environment: NodeJS.ProcessEnv;
|
||||
path(...segments: readonly string[]): string;
|
||||
mkdir(relativePath: string): Promise<string>;
|
||||
read(relativePath: string): Promise<string>;
|
||||
write(relativePath: string, contents: string | Uint8Array): Promise<string>;
|
||||
}
|
||||
|
||||
@@ -64,8 +54,6 @@ export const createTestWorkspace = async (
|
||||
return {
|
||||
root,
|
||||
home,
|
||||
xdgConfigHome,
|
||||
xdgCacheHome,
|
||||
environment: {
|
||||
HOME: home,
|
||||
XDG_CONFIG_HOME: xdgConfigHome,
|
||||
@@ -77,7 +65,6 @@ export const createTestWorkspace = async (
|
||||
await mkdir(path, { recursive: true });
|
||||
return path;
|
||||
},
|
||||
read: (relativePath) => readFile(resolvePath(relativePath), "utf8"),
|
||||
write: async (relativePath, contents) => {
|
||||
const path = resolvePath(relativePath);
|
||||
await mkdir(dirname(path), { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user