mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
test: tighten ts topology record assertions
This commit is contained in:
@@ -48,14 +48,35 @@ describe("ts-topology", () => {
|
||||
it("collapses canonical symbols exported by multiple public subpaths", () => {
|
||||
const sharedThing = requireRecordByExport("sharedThing");
|
||||
|
||||
expect(sharedThing).toMatchObject({
|
||||
expect(sharedThing).toEqual({
|
||||
aliasName: undefined,
|
||||
canonicalKey: "src/lib/shared.ts:1:sharedThing",
|
||||
declarationPath: "src/lib/shared.ts",
|
||||
declarationLine: 1,
|
||||
entrypoints: ["extra", "index"],
|
||||
exportNames: ["aliasedSharedThing", "sharedThing"],
|
||||
internalConsumers: [],
|
||||
internalImportCount: 0,
|
||||
internalRefCount: 0,
|
||||
isTypeOnlyCandidate: false,
|
||||
kind: "function",
|
||||
moveBackToOwnerScore: 0,
|
||||
productionConsumers: [
|
||||
"extensions/alpha/src/use.ts",
|
||||
"extensions/beta/src/use.ts",
|
||||
"src/internal/use.ts",
|
||||
],
|
||||
productionExtensions: ["alpha", "beta"],
|
||||
productionImportCount: 4,
|
||||
productionPackages: ["src"],
|
||||
productionRefCount: 4,
|
||||
productionOwners: ["extension:alpha", "extension:beta", "src"],
|
||||
publicSpecifiers: ["fixture-sdk", "fixture-sdk/extra"],
|
||||
sharednessScore: 90,
|
||||
testConsumers: [],
|
||||
testImportCount: 0,
|
||||
testRefCount: 0,
|
||||
});
|
||||
expect(sharedThing.publicSpecifiers).toEqual(["fixture-sdk", "fixture-sdk/extra"]);
|
||||
});
|
||||
|
||||
it("counts renamed imports, namespace imports, type-only imports, and test-only consumers", () => {
|
||||
@@ -64,14 +85,54 @@ describe("ts-topology", () => {
|
||||
const testOnlyThing = requireRecordByExport("testOnlyThing");
|
||||
|
||||
expect(aliasedThing.productionRefCount).toBe(1);
|
||||
expect(sharedType).toMatchObject({
|
||||
expect(sharedType).toEqual({
|
||||
aliasName: undefined,
|
||||
canonicalKey: "src/lib/shared.ts:21:SharedType",
|
||||
declarationLine: 21,
|
||||
declarationPath: "src/lib/shared.ts",
|
||||
entrypoints: ["index"],
|
||||
exportNames: ["SharedType"],
|
||||
internalConsumers: [],
|
||||
internalImportCount: 0,
|
||||
internalRefCount: 0,
|
||||
isTypeOnlyCandidate: true,
|
||||
kind: "type",
|
||||
moveBackToOwnerScore: 0,
|
||||
productionConsumers: ["extensions/alpha/src/use.ts", "extensions/beta/src/use.ts"],
|
||||
productionExtensions: ["alpha", "beta"],
|
||||
productionImportCount: 2,
|
||||
productionOwners: ["extension:alpha", "extension:beta"],
|
||||
productionPackages: [],
|
||||
productionRefCount: 2,
|
||||
publicSpecifiers: ["fixture-sdk"],
|
||||
sharednessScore: 75,
|
||||
testConsumers: [],
|
||||
testImportCount: 0,
|
||||
testRefCount: 0,
|
||||
});
|
||||
expect(testOnlyThing).toMatchObject({
|
||||
expect(testOnlyThing).toEqual({
|
||||
aliasName: undefined,
|
||||
canonicalKey: "src/lib/shared.ts:13:testOnlyThing",
|
||||
declarationLine: 13,
|
||||
declarationPath: "src/lib/shared.ts",
|
||||
entrypoints: ["index"],
|
||||
exportNames: ["testOnlyThing"],
|
||||
internalConsumers: [],
|
||||
internalImportCount: 0,
|
||||
internalRefCount: 0,
|
||||
isTypeOnlyCandidate: false,
|
||||
kind: "function",
|
||||
moveBackToOwnerScore: 30,
|
||||
productionConsumers: [],
|
||||
productionExtensions: [],
|
||||
productionImportCount: 0,
|
||||
productionOwners: [],
|
||||
productionPackages: [],
|
||||
productionRefCount: 0,
|
||||
publicSpecifiers: ["fixture-sdk"],
|
||||
sharednessScore: 0,
|
||||
testRefCount: 1,
|
||||
testImportCount: 1,
|
||||
testConsumers: ["tests/public.test.ts"],
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user