Skip to content

Commit

Permalink
Fix more tests missing 'it' call in 'describe' (microsoft#48994)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed May 6, 2022
1 parent 4a0b083 commit 4765355
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/testRunner/unittests/publicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,30 +180,34 @@ describe("unittests:: Public APIs:: validateLocaleAndSetLanguage", () => {
});

describe("unittests:: Public APIs :: forEachChild of @param comments in JSDoc", () => {
const content = `
it("finds correct children", () => {
const content = `
/**
* @param The {@link TypeReferencesInAedoc}.
*/
var x
`;
const sourceFile = ts.createSourceFile("/file.ts", content, ts.ScriptTarget.ESNext, /*setParentNodes*/ true);
const paramTag = sourceFile.getChildren()[0].getChildren()[0].getChildren()[0].getChildren()[0];
const kids = paramTag.getChildren();
const seen: Set<ts.Node> = new Set();
ts.forEachChild(paramTag, n => {
assert.strictEqual(/*actual*/ false, seen.has(n), "Found a duplicate-added child");
seen.add(n);
const sourceFile = ts.createSourceFile("/file.ts", content, ts.ScriptTarget.ESNext, /*setParentNodes*/ true);
const paramTag = sourceFile.getChildren()[0].getChildren()[0].getChildren()[0].getChildren()[0];
const kids = paramTag.getChildren();
const seen: Set<ts.Node> = new Set();
ts.forEachChild(paramTag, n => {
assert.strictEqual(/*actual*/ false, seen.has(n), "Found a duplicate-added child");
seen.add(n);
});
assert.equal(5, kids.length);
});
assert.equal(5, kids.length);
});

describe("unittests:: Public APIs:: getChild* methods on EndOfFileToken with JSDoc", () => {
const content = `
it("finds correct children", () => {
const content = `
/** jsdoc comment attached to EndOfFileToken */
`;
const sourceFile = ts.createSourceFile("/file.ts", content, ts.ScriptTarget.ESNext, /*setParentNodes*/ true);
const endOfFileToken = sourceFile.getChildren()[1];
assert.equal(endOfFileToken.getChildren().length, 1);
assert.equal(endOfFileToken.getChildCount(), 1);
assert.notEqual(endOfFileToken.getChildAt(0), /*expected*/ undefined);
const sourceFile = ts.createSourceFile("/file.ts", content, ts.ScriptTarget.ESNext, /*setParentNodes*/ true);
const endOfFileToken = sourceFile.getChildren()[1];
assert.equal(endOfFileToken.getChildren().length, 1);
assert.equal(endOfFileToken.getChildCount(), 1);
assert.notEqual(endOfFileToken.getChildAt(0), /*expected*/ undefined);
});
});

0 comments on commit 4765355

Please sign in to comment.