From 9d7cfddb4ff0082b72762406a926941cc4c16a40 Mon Sep 17 00:00:00 2001 From: Clawd Agent Date: Tue, 28 Apr 2026 01:38:07 +0200 Subject: [PATCH] test: convert phase-06-tests.js from Jest to Node.js native test runner Replace describe/before/it/expect() (Jest) with the node:test module and node:assert. All test logic, endpoints, and assertion semantics are preserved; the file now runs with: node --test backend/test/phase-06-tests.js Co-Authored-By: claude-flow --- backend/test/phase-06-tests.js | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/backend/test/phase-06-tests.js b/backend/test/phase-06-tests.js index bd3939a..616b8b4 100644 --- a/backend/test/phase-06-tests.js +++ b/backend/test/phase-06-tests.js @@ -1,3 +1,5 @@ +const { test, describe, before } = require('node:test'); +const assert = require('node:assert'); const request = require('supertest'); const app = require('../src/index.js'); const { Pool } = require('pg'); @@ -29,49 +31,49 @@ describe('Phase 06 - Recovery Tracking & Swap System', () => { }); describe('06-02: Muscle Group Recovery Tracking', () => { - it('GET /api/recovery/muscle-groups - should return recovery status', async () => { + test('GET /api/recovery/muscle-groups - should return recovery status', async () => { const res = await request(app) .get('/api/recovery/muscle-groups') .set('Authorization', `Bearer ${authToken}`); - expect(res.status).toBe(200); - expect(res.body).toHaveProperty('userId'); - expect(res.body).toHaveProperty('muscleGroups'); - expect(Array.isArray(res.body.muscleGroups)).toBe(true); + assert.strictEqual(res.status, 200); + assert.ok('userId' in res.body, 'response should have userId'); + assert.ok('muscleGroups' in res.body, 'response should have muscleGroups'); + assert.ok(Array.isArray(res.body.muscleGroups), 'muscleGroups should be an array'); }); - it('GET /api/recovery/most-recovered - should return top recovered groups', async () => { + test('GET /api/recovery/most-recovered - should return top recovered groups', async () => { const res = await request(app) .get('/api/recovery/most-recovered?limit=3') .set('Authorization', `Bearer ${authToken}`); - expect(res.status).toBe(200); - expect(res.body).toHaveProperty('recovered'); - expect(res.body.limit).toBe(3); + assert.strictEqual(res.status, 200); + assert.ok('recovered' in res.body, 'response should have recovered'); + assert.strictEqual(res.body.limit, 3); }); }); describe('06-03: Smart Workout Recommendations', () => { - it('GET /api/recommendations/smart-workout - should return recommendations', async () => { + test('GET /api/recommendations/smart-workout - should return recommendations', async () => { const res = await request(app) .get('/api/recommendations/smart-workout') .set('Authorization', `Bearer ${authToken}`); - expect(res.status).toBe(200); - expect(res.body).toHaveProperty('recommendations'); - expect(Array.isArray(res.body.recommendations)).toBe(true); + assert.strictEqual(res.status, 200); + assert.ok('recommendations' in res.body, 'response should have recommendations'); + assert.ok(Array.isArray(res.body.recommendations), 'recommendations should be an array'); }); }); describe('06-01: Workout Swap System', () => { - it('GET /api/workouts/available - should return available exercises', async () => { + test('GET /api/workouts/available - should return available exercises', async () => { const res = await request(app) .get('/api/workouts/available') .set('Authorization', `Bearer ${authToken}`); - expect(res.status).toBe(200); - expect(res.body).toHaveProperty('exercises'); - expect(Array.isArray(res.body.exercises)).toBe(true); + assert.strictEqual(res.status, 200); + assert.ok('exercises' in res.body, 'response should have exercises'); + assert.ok(Array.isArray(res.body.exercises), 'exercises should be an array'); }); }); });