Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY}}
PORT: 4000
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run start & sleep 3
- run: npm test
- run: echo "Deploying to ${{ inputs.environment || 'dev' }}..."
46 changes: 22 additions & 24 deletions test/smoke.test.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// import assert from 'node:assert/strict';
// assert.equal(1 + 1, 2, 'Math still works');
// import '../server/server.js';
// console.log('✅ smoke test passed');
// import 'dotenv/config';
// import { healthCheck } from '../server/db.js';
import fetch from 'node-fetch';

// async function main() {
// try {
// console.log('Running a smoke test');
const port = process.env.PORT || 4000;
const url = `http://localhost:${port}/health`;

// const ok = await healthCheck();
// if (!ok) {
// console.error("❌ Health check didn't pass");
// process.exit(1);
// }
async function main() {
try {
console.log(`🔎 Checking API health @ ${url} ...`);
const res = await fetch(url);
const json = await res.json();

// console.log('✅ Health check passed!');
// process.exit(0);
// } catch (error) {
// console.error('Smoke test failed');
// process.exit(1);
// }
// }
// const ok = await healthCheck();
if (!res.ok || !json.ok) {
console.error('❌ Health check didn"t pass', json);
process.exit(1);
}

// main();
console.log('✅ CI smoke test stub: nothing to check yet.');
process.exit(0);
console.log('✅ Health check passed!', json);
process.exit(0);
} catch (error) {
console.error('❌ Smoke test failed');
process.exit(1);
}
}

main();