Files
hive/frontend/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js
anthonyrawlins e89f2f4b7b Add comprehensive development roadmap via GitHub Issues
Created 10 detailed GitHub issues covering:
- Project activation and management UI (#1-2)
- Worker node coordination and visualization (#3-4)
- Automated GitHub repository scanning (#5)
- Intelligent model-to-issue matching (#6)
- Multi-model task execution system (#7)
- N8N workflow integration (#8)
- Hive-Bzzz P2P bridge (#9)
- Peer assistance protocol (#10)

Each issue includes detailed specifications, acceptance criteria,
technical implementation notes, and dependency mapping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 19:41:01 +10:00

124 lines
4.8 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var try_path_1 = require("../try-path");
var path_1 = require("path");
describe("mapping-entry", function () {
var abosolutePathMappings = [
{
pattern: "longest/pre/fix/*",
paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")],
},
{ pattern: "pre/fix/*", paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")] },
{ pattern: "*", paths: [(0, path_1.join)("/absolute", "base", "url", "foo1")] },
];
var abosolutePathMappingsStarstWithSlash = [
{
pattern: "/opt/*",
paths: [(0, path_1.join)("/absolute", "src", "aws-layer")],
},
{
pattern: "*",
paths: [(0, path_1.join)("/absolute", "src")],
},
];
it("should return no paths for relative requested module", function () {
var result = (0, try_path_1.getPathsToTry)([".ts", "tsx"], abosolutePathMappings, "./requested-module");
expect(result).toBeUndefined();
});
it("should return no paths if no pattern match the requested module", function () {
var result = (0, try_path_1.getPathsToTry)([".ts", "tsx"], [
{
pattern: "longest/pre/fix/*",
paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")],
},
{
pattern: "pre/fix/*",
paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")],
},
], "requested-module");
expect(result).toBeUndefined();
});
it("should get all paths that matches requested module", function () {
var result = (0, try_path_1.getPathsToTry)([".ts", ".tsx"], abosolutePathMappings, "longest/pre/fix/requested-module");
expect(result).toEqual([
// "longest/pre/fix/*"
{ type: "file", path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar") },
{
type: "extension",
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar.ts"),
},
{
type: "extension",
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar.tsx"),
},
{
type: "package",
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "package.json"),
},
{
type: "index",
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "index.ts"),
},
{
type: "index",
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "index.tsx"),
},
// "*"
{ type: "file", path: (0, path_1.join)("/absolute", "base", "url", "foo1") },
{ type: "extension", path: (0, path_1.join)("/absolute", "base", "url", "foo1.ts") },
{ type: "extension", path: (0, path_1.join)("/absolute", "base", "url", "foo1.tsx") },
{
type: "package",
path: (0, path_1.join)("/absolute", "base", "url", "foo1", "package.json"),
},
{
type: "index",
path: (0, path_1.join)("/absolute", "base", "url", "foo1", "index.ts"),
},
{
type: "index",
path: (0, path_1.join)("/absolute", "base", "url", "foo1", "index.tsx"),
},
]);
});
it("should resolve paths starting with a slash", function () {
var result = (0, try_path_1.getPathsToTry)([".ts"], abosolutePathMappingsStarstWithSlash, "/opt/utils");
expect(result).toEqual([
// "opt/*"
{
path: (0, path_1.join)("/absolute", "src", "aws-layer"),
type: "file",
},
{
path: (0, path_1.join)("/absolute", "src", "aws-layer.ts"),
type: "extension",
},
{
path: (0, path_1.join)("/absolute", "src", "aws-layer", "package.json"),
type: "package",
},
{
path: (0, path_1.join)("/absolute", "src", "aws-layer", "index.ts"),
type: "index",
},
// "*"
{
path: (0, path_1.join)("/absolute", "src"),
type: "file",
},
{
path: (0, path_1.join)("/absolute", "src.ts"),
type: "extension",
},
{
path: (0, path_1.join)("/absolute", "src", "package.json"),
type: "package",
},
{
path: (0, path_1.join)("/absolute", "src", "index.ts"),
type: "index",
},
]);
});
});
//# sourceMappingURL=try-path.test.js.map