diff --git a/README.md b/README.md index 6a468dd0..e8d8b4d5 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,22 @@ Here're some of the project's best features: ``` 3. **Run Development Server**: + ```bash npm run dev ``` +4. **Run Tests**: + + ```bash + npm test + ``` + +5. **Run Coverage Report**: + ```bash + npm run test:coverage + ``` +

💻 Built with

Technologies used in the project: diff --git a/__tests__/convert/html-jsx/htmlToJsx.test.js b/__tests__/convert/html-jsx/htmlToJsx.test.js new file mode 100644 index 00000000..ae99d8d5 --- /dev/null +++ b/__tests__/convert/html-jsx/htmlToJsx.test.js @@ -0,0 +1,25 @@ +import { htmlToJsx } from "html-to-jsx-transform"; + +describe("htmlToJsx transformer", () => { + it("converts HTML attributes and nested content to JSX", () => { + const html = + '

Title

Summary

'; + const expected = + '

Title

Summary

'; + + expect(htmlToJsx(html)).toBe(expected); + }); + + it("handles boolean attributes and self-closing tags", () => { + expect(htmlToJsx('')).toBe( + '', + ); + }); + + it("preserves attribute values with mixed quotes and whitespace", () => { + const html = ''; + expect(htmlToJsx(html)).toBe( + '', + ); + }); +}); diff --git a/__tests__/convert/html-jsx/page.test.jsx b/__tests__/convert/html-jsx/page.test.jsx new file mode 100644 index 00000000..4d7a9751 --- /dev/null +++ b/__tests__/convert/html-jsx/page.test.jsx @@ -0,0 +1,83 @@ +import React from "react"; +import { render, screen, fireEvent, waitFor } from "@testing-library/react"; +import HTML_JSX from "@/app/convert/html-jsx/page"; + +jest.mock("@monaco-editor/react", () => ({ + Editor: ({ language, value, onChange }) => ( +