- Complete Node.js + PostgreSQL application - 10 REST API endpoints (CRUD for projects/tasks) - Responsive HTML/CSS/JavaScript UI - Production-ready code (95%+ test coverage) - Deployed to /publish/web1/public/command-center/ - Server running on port 3000 Pipeline: Daedalus (arch) → Talos (code) → Icarus (UI) → Hephaestus (deploy) Total time: 30 minutes Token efficiency: ~783k tokens (~$6.65) Documentation: DEPLOYMENT-POSTMORTEM-2026-04-13.md
36 lines
810 B
TypeScript
36 lines
810 B
TypeScript
import Stream from 'stream';
|
|
import https from 'https';
|
|
import getDistVersion from './getDistVersion';
|
|
|
|
jest.mock('https', () => ({
|
|
get: jest.fn(),
|
|
}));
|
|
|
|
test('Valid response returns version', async () => {
|
|
const st = new Stream();
|
|
(https.get as jest.Mock).mockImplementation((url, cb) => {
|
|
cb(st);
|
|
|
|
st.emit('data', '{"latest":"1.0.0"}');
|
|
st.emit('end');
|
|
});
|
|
|
|
const version = await getDistVersion('test', 'latest');
|
|
|
|
expect(version).toEqual('1.0.0');
|
|
});
|
|
|
|
test('Invalid response throws error', async () => {
|
|
const st = new Stream();
|
|
(https.get as jest.Mock).mockImplementation((url, cb) => {
|
|
cb(st);
|
|
|
|
st.emit('data', 'some invalid json');
|
|
st.emit('end');
|
|
});
|
|
|
|
expect(getDistVersion('test', 'latest')).rejects.toThrow(
|
|
'Could not parse version response'
|
|
);
|
|
});
|