testRemotesAsTypedGoWhereTheyMean
A remote given as typed goes where it means: a bare host to its server, anything else to a directory.
import { remoteLocation } from "#codebase/tcmts/cli/sync"; import assert from "node:assert/strict"; import path from "node:path"; export const testRemotesAsTypedGoWhereTheyMean = () => { assert.equal(remoteLocation("https://tcm.codes"), "https://tcm.codes"); assert.equal(remoteLocation("http://127.0.0.1:7737"), "http://127.0.0.1:7737"); assert.equal(remoteLocation("tcm.codes"), "https://tcm.codes"); assert.equal(remoteLocation("code.alice.dev:8443/notes"), "https://code.alice.dev:8443/notes"); assert.equal(remoteLocation("localhost:7737"), "http://localhost:7737"); assert.equal(remoteLocation("127.0.0.1:7737"), "http://127.0.0.1:7737"); assert.equal(remoteLocation("elsewhere"), path.resolve("elsewhere")); assert.equal(remoteLocation("../other.v2"), path.resolve("../other.v2")); assert.equal(remoteLocation(process.cwd()), process.cwd()); }