Skip to content

Commit

Permalink
Create app.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AravindRajeshkanna authored Sep 18, 2024
1 parent f835896 commit 8958ac2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const request = require('supertest');
const app = require('../src/index');

describe('API Endpoints', () => {
it('should return API health', async () => {
const res = await request(app).get('/health');
expect(res.statusCode).toEqual(200);
expect(res.body).toHaveProperty('status', 'API is healthy');
});

it('should return sample data', async () => {
const res = await request(app).get('/api/data');
expect(res.statusCode).toEqual(200);
expect(res.body).toHaveProperty('message', 'Here is your data!');
});
});

0 comments on commit 8958ac2

Please sign in to comment.