Skip to content

Commit

Permalink
test: prepare for additional utils
Browse files Browse the repository at this point in the history
  • Loading branch information
GalacticHypernova authored Jan 25, 2024
1 parent ef84840 commit fb40933
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ import { expect, it, describe } from "vitest";
import { extractJSDoc } from "../src";

describe("unjsdoc", () => {
it("should extract jsdoc", () => {
const jsdoc = extractJSDoc("../playground", "hasJSDoc");
expect(jsdoc[0]).toMatchSnapshot(`
/**
* Test function with JSDoc
* @param test
* @param test2
* @returns {number}
*/`);
});
it("should return null for non-existent jsdoc", () => {
const jsdoc = extractJSDoc("../playground", "noJSDoc");
// eslint-disable-next-line unicorn/no-null
expect(jsdoc).toEqual(null);
});
it("should return null for non-existent function", () => {
const jsdoc = extractJSDoc("../playground", "noFunction");
// eslint-disable-next-line unicorn/no-null
expect(jsdoc).toEqual(null);
decribe("extractJSDoc", () => {
it("should extract jsdoc", () => {
const jsdoc = extractJSDoc("../playground", "hasJSDoc");
expect(jsdoc[0]).toMatchSnapshot(`
/**
* Test function with JSDoc
* @param test
* @param test2
* @returns {number}
*/`);
});
it("should return null for non-existent jsdoc", () => {
const jsdoc = extractJSDoc("../playground", "noJSDoc");
// eslint-disable-next-line unicorn/no-null
expect(jsdoc).toEqual(null);
});
it("should return null for non-existent function", () => {
const jsdoc = extractJSDoc("../playground", "noFunction");
// eslint-disable-next-line unicorn/no-null
expect(jsdoc).toEqual(null);
});
});
});

0 comments on commit fb40933

Please sign in to comment.