Skip to content
This repository has been archived by the owner on Aug 29, 2021. It is now read-only.

Commit

Permalink
Fix doc walker tests not running
Browse files Browse the repository at this point in the history
  • Loading branch information
Levertion committed Aug 31, 2018
1 parent b11e3a3 commit ce0793b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/data/noncached.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const rootNodePath = require.resolve("mc-nbt-paths/root.json");
export const modulePath = path.dirname(rootNodePath);

export async function setupFiles(dir: string = modulePath): Promise<MemoryFS> {
const docfs = new MemoryFS(modulePath);
const docfs = new MemoryFS(dir);
const paths = await walkDir(dir);
const promises: Array<Promise<void>> = [];
for (const p of paths) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
IPCMessageWriter,
TextDocumentSyncKind
} from "vscode-languageserver/lib/main";
import { mergeDeep } from "./misc-functions/third_party/merge-deep";

import { computeCompletions } from "./completions";
import { readSecurity } from "./data/cache";
Expand All @@ -26,6 +25,7 @@ import {
setup_logging,
splitLines
} from "./misc-functions";
import { mergeDeep } from "./misc-functions/third_party/merge-deep";
import { parseDocument, parseLines } from "./parse";
import { FunctionInfo, MiscInfo, WorkspaceSecurity } from "./types";

Expand Down
21 changes: 14 additions & 7 deletions src/test/parsers/minecraft/nbt/doc-walker.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import * as assert from "assert";
import * as path from "path";
import { setupFiles } from "../../../../data/noncached";
import { MemoryFS } from "../../../../parsers/minecraft/nbt/doc-fs";
import { NBTWalker } from "../../../../parsers/minecraft/nbt/doc-walker";
import { NBTTagCompound } from "../../../../parsers/minecraft/nbt/tag/compound-tag";
import { NBTTagString } from "../../../../parsers/minecraft/nbt/tag/string-tag";

describe("Documentation Walker Tests", () => {
describe("getFinalNode()", async () => {
const nbt = new NBTTagCompound({ var1: new NBTTagString("func_test") });
const dataPath = path.resolve(
__dirname,
"../../../../../test_data/test_docs"
);
before(async () => {
const nbt = new NBTTagCompound({
var1: new NBTTagString("func_test")
});
const dataPath = path.resolve(
__dirname,
"../../../../../test_data/test_docs"
);
v = await setupFiles(dataPath);
walker = new NBTWalker(nbt, v, "root.json");
});

const v = await setupFiles(path.dirname(dataPath));
let v: MemoryFS;
let walker: NBTWalker;

const walker = new NBTWalker(nbt, v, "root.json");
it("should return the correct node for the basic doc", () => {
const node = walker.getFinalNode(["basic_test"]);
if (!node) {
Expand Down

0 comments on commit ce0793b

Please sign in to comment.