import { describe, it, expect } from "vitest";
import importUtils from "./utils.js";
describe("#extractHtmlTitle", () => {
const htmlWithNotTitle = `
abc
`;
const htmlWithTitle = `
Test Title
abc
`;
const htmlWithTitleWOpeningBracket = `
Test < Title
abc
`;
type TestCaseExtractHtmlTitle = [htmlContent: string, expected: string | null, description: string];
const testCases: TestCaseExtractHtmlTitle[] = [
[htmlWithTitle, "Test Title", "with existing tag"],
[htmlWithTitleWOpeningBracket, null, "with existing tag, that includes '<'"],
[htmlWithNotTitle, null, "without existing tag"],
["", null, "with empty content"]
];
testCases.forEach((testCase) => {
return it(`${(testCase[2])}, it should return '${testCase[1]}'`, () => {
const [value, expected] = testCase;
const actual = importUtils.extractHtmlTitle(value);
expect(actual).toStrictEqual(expected);
});
});
})
describe.todo("#handleH1", () => {
//TODO
})