added tests
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
name: Test Web Formatting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
formatting:
|
||||
name: Web Formatting
|
||||
uses: gitea.gt-proj.com/brian/CI-templates/.gitea/workflows/web/formatting.yml@main
|
||||
with:
|
||||
node-version: "20"
|
||||
prettier-config: ".prettierrc.json"
|
||||
check-yaml: true
|
||||
check-json: true
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"semi": true,
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Test Web App
|
||||
description: A simple web application for testing
|
||||
|
||||
api:
|
||||
version: v1
|
||||
endpoints:
|
||||
- name: health
|
||||
path: /health
|
||||
method: GET
|
||||
- name: calculator
|
||||
path: /calculate
|
||||
method: POST
|
||||
|
||||
database:
|
||||
type: sqlite
|
||||
name: test.db
|
||||
|
||||
logging:
|
||||
level: info
|
||||
format: json
|
||||
@@ -0,0 +1,15 @@
|
||||
console.log("Hello, World!");
|
||||
|
||||
const calculator = {
|
||||
add: (a, b) => a + b,
|
||||
subtract: (a, b) => a - b,
|
||||
multiply: (a, b) => a * b,
|
||||
divide: (a, b) => {
|
||||
if (b === 0) {
|
||||
throw new Error("Cannot divide by zero");
|
||||
}
|
||||
return a / b;
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = calculator;
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "test-web-project",
|
||||
"version": "1.0.0",
|
||||
"description": "Test web project for CI template validation",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check ."
|
||||
},
|
||||
"keywords": ["test", "ci", "templates"],
|
||||
"author": "Test Author",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"prettier": "^3.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user