tests
Pagez's tests, apart from its sources.
elements/holds the elements' unit tests, one file for each source insrc/elements/.pages/holds the pages Pagez must build, or must fail on, written ahead of the compiler.pages.test.tsbuilds each of them, and compares it with its snapshot insnapshots/.sites/holds folders of many pages, andsites.test.tsbuilds every page of each, to its snapshot insnapshots/sites/.speed/holds the scripts that time a large build and hold a page's size to a budget.
Folders
- elements/
The elements' unit tests, one file for each source in src/elements/.
- pages/
The pages Pagez must build, one folder each, written before the compiler to pin down what it does. Each folder holds an
index.mdand whatever sits beside it, such as@x-tag.htmlfiles, anframe.html, astyle.css, scripts, images or anode_modules. - sites/
The sites Pagez must build, or must fail on, one folder each, as the test pages are for one page. Each is a folder of pages, with what pages says about many pages: a page at its folder's path, the nearest
style.cssandframe.html,pagez.mdat the root, links between pages, and what a site adds, frompagesto redirects. - speed/
How fast Pagez builds, and how much it adds to a page. These are scripts, not tests, and development says how to run them.
Code
- args.test.ts
What
pagezmakes of what it's given: a command, a folder and a port, or one line saying what's wrong, with the usage. - check.test.ts
checklists every page's failure and every warning, a line each, with its id, and writes nothing.printedRuleprints a rule, an error or a warning from the docs the package ships. - css.test.ts
The rules the theme keeps, which a change to it could break without any page looking wrong at first. It's one layer, so any other CSS beats it, and it styles only what Markdown writes, with no classes. How it looks is checked by eye, on the prose and stories test pages.
- docs.test.ts
Pages and elements state each rule once, as a list item that opens with its id, and end it with the cases that hold it. This holds the docs and the tests to each other, so a rule can't be stated without a test, and a case can't test what no rule states.
- head.test.ts
What fails a frame, each with the line to add or remove, and the metadata the head reads. Then what Pagez writes in a page's head, which is the page's lang, title and description in place of the frame's, and the tags that follow.
- pages.test.ts
Each page in
tests/pages/builds to its snapshot intests/snapshots/<page>/page.html, or anerror-…page fails witherror.txt, its file named fromtests/pages/. - sites.test.ts
Each site in
tests/sites/builds every page, its404.htmland its_redirectsto their snapshots intests/snapshots/sites/<site>/, at the path each is built at. Anerror-…site fails witherror.txtinstead, its file named fromtests/sites/. Pagez's theme stands as a comment, as inpages.test.ts. - vite.test.ts
The plugin builds a folder's pages through Vite, each to its folder in
dist/, with their references hashed intodist/assets/, each page's elements' behavior bundled into one module, and leaves the folder as it was. A folder that has anindex.htmlwhere a page is built fails, since that's the file Pagez writes.
No prose yet