Skip to content

Commit 0471c7f

Browse files
committed
Attempt to mock navigation map construction
1 parent 35a8ce5 commit 0471c7f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ProcessedTargetsContext,
1313
SelectionWithEditor,
1414
} from "./Types";
15-
import makeGraph from "./makeGraph";
15+
import { makeGraph } from "./makeGraph";
1616
import { logBranchTypes } from "./debug";
1717
import TestCase from "./TestCase";
1818

src/makeGraph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function makeGetter<GraphType, K extends keyof GraphType>(
2525
};
2626
}
2727

28-
export default function makeGraph<GraphType extends object>(
28+
export function makeGraph<GraphType extends object>(
2929
constructorMap: ConstructorMap<GraphType>
3030
) {
3131
const components: Partial<GraphType> = {};

src/test/suite/recorded.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import TestCase, {
1010
SerializedSelection,
1111
TestCaseFixture,
1212
} from "../../TestCase";
13+
import * as makeGraphModule from "../../makeGraph";
14+
import graphConstructors from "../../graphConstructors";
15+
import { SymbolColor } from "../../constants";
1316

1417
function deserializePosition(position: SerializedPosition) {
1518
return new vscode.Position(position.line, position.character);
@@ -57,7 +60,15 @@ suite("recorded test cases", async function () {
5760
// async () => fixture.initialState.clipboard
5861
// );
5962

60-
// TODO verify fixture decorations are in nav. map
63+
// TODO This actually needs to happen before extension activation...
64+
// Assert that recorded decorations are present
65+
// const graph = makeGraphModule.makeGraph(graphConstructors);
66+
// Object.entries(fixture.decorations).forEach(([key, _]) => {
67+
// const [color, character] = key.split(".") as [SymbolColor, string];
68+
// const token = graph.navigationMap.getToken(color, character);
69+
// assert(token != null);
70+
// });
71+
// sinon.replace(makeGraphModule, "makeGraph", sinon.fake.returns(graph));
6172

6273
await new Promise((resolve) => setTimeout(resolve, 1000));
6374

@@ -69,6 +80,7 @@ suite("recorded test cases", async function () {
6980
);
7081

7182
assert.deepStrictEqual(fixture.finalState, await TestCase.getSnapshot());
83+
sinon.restore();
7284
});
7385
});
7486
});

0 commit comments

Comments
 (0)