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

test: add tests to templates, fix some bugs #3

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
linkinator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: JustinBeckwith/linkinator-action@v1
- uses: actions/checkout@v4
- uses: JustinBeckwith/linkinator-action@39e601e
with:
paths: "**/*.md"
markdown: true
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/lint-templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Test Suite: Linter (templates)"

on:
push:
pull_request:
paths:
- 'templates/**'
branches:
- main
workflow_dispatch:

jobs:
tests:
if: github.repository == 'cutenode/retrogen'
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: current
- name: Install most recent npm
run: npm install -g npm
- name: Run npm install -w templates
run: npm install -w templates
- name: Run npm run lint -w templates
run: npm run lint -w templates
32 changes: 32 additions & 0 deletions .github/workflows/test-templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Test Suite: @retrogen/templates"

on:
pull_request:
paths:
- 'templates/**'
branches:
- main
workflow_dispatch:

jobs:
tests:
if: github.repository == 'cutenode/retrogen'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [current]
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install most recent npm
run: npm install -g npm
- name: Run npm install -w templates
run: npm install -w templates
- name: Run npm test -w templates
run: npm test -w templates
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions core/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
"organizeImports": {
"enabled": true
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
18 changes: 9 additions & 9 deletions core/examples/default.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const core = require('@retrogen/core')
const core = require('@retrogen/core');

async function generate () {
const dates = {
start: '2022-01-01',
end: '2022-01-31'
}
async function generate() {
const dates = {
start: '2022-01-01',
end: '2022-01-31',
};

const data = await core('nodejs', dates)
const data = await core('nodejs', dates);

console.log(JSON.stringify(data, null, 2))
console.log(JSON.stringify(data, null, 2));
}

generate()
generate();
26 changes: 13 additions & 13 deletions core/examples/defaultWithOptions.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const core = require('@retrogen/core')
const core = require('@retrogen/core');

async function generate () {
const dates = {
start: '2022-01-01',
end: '2022-01-31'
}
async function generate() {
const dates = {
start: '2022-01-01',
end: '2022-01-31',
};

const options = {
sort: 'interactions', // default is `updated`, but assume we want to see what's most interacted with
per_page: 50 // default is 100. Not sure why you'd want to limit this outside of *knowing* you have a small size and speeding up the query.
}
const options = {
sort: 'interactions', // default is `updated`, but assume we want to see what's most interacted with
per_page: 50, // default is 100. Not sure why you'd want to limit this outside of *knowing* you have a small size and speeding up the query.
};

const data = await core('nodejs', dates, options)
const data = await core('nodejs', dates, options);

console.log(JSON.stringify(data, null, 2))
console.log(JSON.stringify(data, null, 2));
}

generate()
generate();
Loading
Loading