feat: tests and workflow
Node.js CI / Lint and Test (pull_request) Successful in 37s

This commit is contained in:
2025-07-19 16:09:32 -07:00
parent 57366fd082
commit 954cad4494
6 changed files with 93 additions and 3 deletions
+38
View File
@@ -0,0 +1,38 @@
name: Node.js CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint and Test
steps:
- name: Checkout Source Files
uses: actions/checkout@v4
- name: Use Node.js v22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9
- name: Install Dependencies
run: pnpm install
- name: Lint Source Files
run: pnpm run lint
- name: Verify Build
run: pnpm run build
- name: Run Tests
run: pnpm run test
+3 -2
View File
@@ -8,7 +8,7 @@
"lint": "eslint ./src --max-warnings 0", "lint": "eslint ./src --max-warnings 0",
"build": "tsc", "build": "tsc",
"start": "op run --env-file=./prod.env -- node ./prod/index.js", "start": "op run --env-file=./prod.env -- node ./prod/index.js",
"test": "echo 'No tests yet' && exit 0" "test": "vitest run"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@@ -18,7 +18,8 @@
"@nhcarrigan/eslint-config": "5.2.0", "@nhcarrigan/eslint-config": "5.2.0",
"@nhcarrigan/typescript-config": "4.0.0", "@nhcarrigan/typescript-config": "4.0.0",
"eslint": "9.31.0", "eslint": "9.31.0",
"typescript": "5.8.3" "typescript": "5.8.3",
"vitest": "3.2.4"
}, },
"dependencies": { "dependencies": {
"@nhcarrigan/logger": "1.0.0", "@nhcarrigan/logger": "1.0.0",
+3
View File
@@ -30,6 +30,9 @@ importers:
typescript: typescript:
specifier: 5.8.3 specifier: 5.8.3
version: 5.8.3 version: 5.8.3
vitest:
specifier: 3.2.4
version: 3.2.4(@types/node@24.0.15)
packages: packages:
+37
View File
@@ -0,0 +1,37 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { anime } from "../src/assets/anime.js";
import { cats } from "../src/assets/cats.js";
import { emoji } from "../src/assets/emoji.js";
const uniqueAnime = new Set(anime.map((art) => {
return art.text;
}));
const uniqueCats = new Set(cats.map((art) => {
return art.text;
}));
const uniqueEmoji = new Set(emoji.map((art) => {
return art.text;
}));
describe("assets", () => {
it("anime should be unique", () => {
expect.assertions(1);
expect(uniqueAnime.size, "anime has duplicate art").toBe(anime.length);
});
it("cats should be unique", () => {
expect.assertions(1);
expect(uniqueCats.size, "cats has duplicate art").toBe(cats.length);
});
it("emoji should be unique", () => {
expect.assertions(1);
expect(uniqueEmoji.size, "emoji has duplicate art").toBe(emoji.length);
});
});
+2 -1
View File
@@ -3,5 +3,6 @@
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./prod" "outDir": "./prod"
} },
"exclude": ["test", "vitest.config.ts"]
} }
+10
View File
@@ -0,0 +1,10 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { defineConfig } from "vitest/config";
export default defineConfig({});