mirror of
https://github.com/hanzoai/dev-desktop.git
synced 2026-11-20 01:07:23 +00:00
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
import { assert, it } from "@effect/vitest";
|
|
import * as Effect from "effect/Effect";
|
|
import * as FileSystem from "effect/FileSystem";
|
|
import * as Path from "effect/Path";
|
|
|
|
import { referenceRepos } from "./lib/reference-repos.ts";
|
|
import { planReferenceRepoSync, resolveReferenceRepoRef } from "./sync-reference-repos.ts";
|
|
|
|
const effectRepo = referenceRepos[0]!;
|
|
const alchemyEffect = referenceRepos[1]!;
|
|
|
|
it.layer(NodeServices.layer)("sync-reference-repos", (it) => {
|
|
it.effect("resolves reference tags from the root catalog", () =>
|
|
Effect.gen(function* () {
|
|
const fs = yield* FileSystem.FileSystem;
|
|
const path = yield* Path.Path;
|
|
const rootDir = yield* fs.makeTempDirectoryScoped({
|
|
prefix: "sync-reference-repos-version-",
|
|
});
|
|
yield* fs.writeFileString(
|
|
path.join(rootDir, "pnpm-workspace.yaml"),
|
|
"catalog:\n alchemy: 2.0.0-beta.84\n effect: 4.0.0-beta.73\n",
|
|
);
|
|
|
|
assert.equal(
|
|
yield* resolveReferenceRepoRef(effectRepo, rootDir, false),
|
|
"[email protected]",
|
|
);
|
|
assert.equal(yield* resolveReferenceRepoRef(alchemyEffect, rootDir, false), "v2.0.0-beta.84");
|
|
}),
|
|
);
|
|
|
|
it.effect("plans a shallow, tagless clone of the resolved ref", () =>
|
|
Effect.gen(function* () {
|
|
const fs = yield* FileSystem.FileSystem;
|
|
const path = yield* Path.Path;
|
|
const rootDir = yield* fs.makeTempDirectoryScoped({
|
|
prefix: "sync-reference-repos-plan-",
|
|
});
|
|
yield* fs.writeFileString(
|
|
path.join(rootDir, "pnpm-workspace.yaml"),
|
|
"catalog:\n effect: 4.0.0-beta.73\n",
|
|
);
|
|
|
|
const plan = yield* planReferenceRepoSync(effectRepo, rootDir, false);
|
|
assert.equal(plan.ref, "[email protected]");
|
|
assert.deepStrictEqual(plan.cloneArgs, [
|
|
"clone",
|
|
"--quiet",
|
|
"--depth=1",
|
|
"--no-tags",
|
|
"--single-branch",
|
|
"[email protected]",
|
|
"https://github.com/Effect-TS/effect.git",
|
|
]);
|
|
}),
|
|
);
|
|
});
|