Skip to content

Commit 2170df5

Browse files
committed
Add tests scaffold, linting and GitHub workflow
1 parent 95510be commit 2170df5

7 files changed

Lines changed: 1987 additions & 38 deletions

File tree

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Reboot.dev Node.js Template
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Lint sources
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version: '18.x'
15+
cache: 'npm'
16+
- run: npm ci
17+
- run: npm run lint
18+
19+
test:
20+
name: Test
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Run all tests
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '18.x'
28+
cache: 'npm'
29+
- run: npm ci
30+
- run: npm run test

backend/src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Application } from "@reboot-dev/reboot";
1+
import { Application, ExternalContext } from "@reboot-dev/reboot";
22

3-
const initialize = async (context) => {};
3+
const initialize = async (context: ExternalContext) => {};
44

55
new Application({
66
servicers: [],

backend/tests/main.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ExternalContext, Reboot } from "@reboot-dev/reboot";
2+
import { describe, it, before, after } from "node:test";
3+
import assert from "node:assert";
4+
5+
describe("Main Application", async () => {
6+
let context: ExternalContext;
7+
let rbt: Reboot;
8+
9+
before(async () => {
10+
rbt = new Reboot();
11+
await rbt.start();
12+
await rbt.up([]);
13+
context = rbt.createExternalContext("test-runner");
14+
});
15+
16+
after(async () => {
17+
await rbt.stop();
18+
});
19+
20+
describe("Servicer", () => {
21+
it("does not throw", async () => {
22+
assert.ok(context);
23+
});
24+
});
25+
});

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
...tseslint.configs.recommended,
9+
);

0 commit comments

Comments
 (0)