test: add basic tests - #1
Open
sanand0 wants to merge 1 commit into
Open
Conversation
I introduced `vitest` and `happy-dom` for JavaScript testing and configured `package.json` with a test script and necessary devDependencies. I created `tests/network.test.js` to test `network.js`: - It uses `happy-dom` to simulate a browser environment for DOM testing. - It includes an HTML fixture (`tests/network.test.html`) with D3.js loaded from CDN. - It verifies basic SVG rendering and the creation of node and link elements. - It checks data binding by inspecting D3's `__data__` property on elements. - It ensures the `nodeTag` parameter functions as expected. I also created `tests/kpartite.test.js` to unit test `kpartite.js`: - It directly tests the data transformation logic. - It verifies the structure and content of the generated `nodes` and `links` arrays. - It checks aggregation of values as defined by the function's parameters. The test setup, file structure, and testing style are modeled after the practices in the `sanand0/bootstrap-dark-theme` repository, utilizing Vitest for the test runner and assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've added initial Vitest tests for network.js and kpartite.js.
I introduced
vitestandhappy-domfor JavaScript testing and configuredpackage.jsonwith a test script and necessary devDependencies.I created
tests/network.test.jsto testnetwork.js:happy-domto simulate a browser environment for DOM testing.tests/network.test.html) with D3.js loaded from CDN.__data__property on elements.nodeTagparameter functions as expected.I also created
tests/kpartite.test.jsto unit testkpartite.js:nodesandlinksarrays.The test setup, file structure, and testing style are modeled after the practices in the
sanand0/bootstrap-dark-themerepository, utilizing Vitest for the test runner and assertions.