| Level Navigation: 1 | 2 | 3 | (4ℹ️) | (5ℹ️) | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14⚡ | 15⚡ | (16ℹ️) | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26⚡ | 27⚡ | 28⚡ | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39⚡ | 40⚡ |
Add a test for your Happy Birthday JSON route (Level 2.5). This tests a simple GET endpoint that returns JSON.
it('returns JSON from Happy Birthday route', async () => {
const res = await request(app).get('/happy-birthday');
expect(res.status).toBe(200);
expect(res.body).toHaveProperty('name');
expect(res.body).toHaveProperty('age');
expect(res.body).toHaveProperty('greeting');
expect(res.headers['content-type']).toMatch(/json/);
});