Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial tests set up #10

Merged
merged 5 commits into from
Mar 19, 2021
Merged

Initial tests set up #10

merged 5 commits into from
Mar 19, 2021

Conversation

matthewp
Copy link
Contributor

This adds tests using uvu (we can switch if people want) and restructures things a bit so that it's easier to test.

Like in snowpack you set up a little project. In our tests you can say:

const result = await runtime.load('/blog/hello-world')

And analyze the result. I included a test-helpers.js which has a function that will turn HTML into a cheerio instance, for inspecting the result HTML.

src/codegen/index.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,26 @@
name: Node CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: we need to make sure that billing is enabled since this is a private repo to use this action

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(GitHub Actions is only free for public repos)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize that. I can always remove this file if we'd rather wait.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah that’s why I didn’t add the format-on-commit action here yet

try {
const result = await snowpack.loadUrl(reqPath);
switch(result.statusCode) {
case 200: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I will always appreciate a good switch

This adds tests using uvu (we can switch if people want) and restructures things a bit so that it's easier to test.

Like in snowpack you set up a little project. In our tests you can say:

```js
const result = await runtime.load('/blog/hello-world')
```

And analyze the result. I included a `test-helpers.js` which has a function that will turn HTML into a cheerio instance, for inspecting the result HTML.
@matthewp matthewp merged commit 17c3c98 into main Mar 19, 2021
@matthewp matthewp deleted the debugging-markdown branch March 19, 2021 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants