Merge branch 'main' into cli
This commit is contained in:
commit
1e14211177
5 changed files with 26 additions and 4 deletions
|
@ -21,7 +21,7 @@ jobs:
|
|||
- run: apt-get install -y postgresql-client
|
||||
- run: NODE_ENV=production npm ci
|
||||
- run: cat migrations/*.sql|PGPASSWORD=postgres psql -h test-db -U postgres test-db
|
||||
- run: node tests/index.js
|
||||
- run: DB_CONNECTION_STRING=postgres://postgres:postgres@test-db/test-db node tests/index.js
|
||||
prettier:
|
||||
runs-on: docker
|
||||
steps:
|
||||
|
@ -35,12 +35,18 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: check
|
||||
run: for a in `find|grep -v node_modules|grep '\.js$'`; do node --check $a && echo "$a OK"; done
|
||||
run: for a in `find|grep -v node_modules|grep '\.js$'`; do node --check $a || exit 1; echo "$a OK"; done
|
||||
boot:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: dependencies
|
||||
run: NODE_ENV=production npm ci
|
||||
- id: boot-test
|
||||
- id: boot-test-1
|
||||
run: TEST_MODE=boot LISTEN_PATH=/tmp/webserver.sock node index.js
|
||||
- id: boot-test-prepare
|
||||
run: mkdir -p /run/user/2123/countify-dev
|
||||
- id: boot-test-dev
|
||||
run: TEST_MODE=boot node index.js
|
||||
- id: boot-test-prod
|
||||
run: TEST_MODE=boot NODE_ENV=production node index.js
|
||||
|
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"editor.tabSize": 2
|
||||
}
|
2
index.js
2
index.js
|
@ -132,7 +132,7 @@ app.get("/stats", function (req, res) {
|
|||
return res.json(stats);
|
||||
});
|
||||
|
||||
const listen_path = process.env?.LISTEN_PATH;
|
||||
var listen_path = process.env?.LISTEN_PATH;
|
||||
if (listen_path == null)
|
||||
listen_path =
|
||||
process.env?.NODE_ENV == "production"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Each test should be imported here.
|
||||
import "./db-sanity.js";
|
||||
import "./validation.js";
|
||||
// This should be the last line.
|
||||
console.log("Tests successful.");
|
||||
|
|
12
tests/validation.js
Normal file
12
tests/validation.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { counter_create } from "../utils.js";
|
||||
import assert from "assert";
|
||||
assert.rejects(async () => {
|
||||
await counter_create({
|
||||
key: "e",
|
||||
value: 1,
|
||||
enable_reset: false,
|
||||
update_lowerbound: 0,
|
||||
update_upperbound: 0,
|
||||
namespace: "test000",
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue