Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chris Ralph #262

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Prev Previous commit
📦 NEW: Finished writing basic tests for currently implemented bands r…
…outer endpoints
ralph734c committed Sep 9, 2024
commit 02d9cc06e7047bf0f63f0e46b31d892482a2a340
28 changes: 26 additions & 2 deletions api/server.test.js
Original file line number Diff line number Diff line change
@@ -5,5 +5,29 @@ describe('GET to /api/bands', () => {
test('API responds with the correct friends list', async () => {
const response = await request(server).get('/api/bands');
expect(response.body).toHaveLength(5);
})
})
});
});

describe('GET to /api/bands/2', () => {
test('API responds with the correct friend for an ID of 2', async () => {
const band = {band_id: 2, band_name: 'TesseracT', genre: 'Progressive Metal'};
const response = await request(server).get('/api/bands/2');
expect(response.body).toMatchObject(band);
});
});

describe('PUT to /api/bands/1', () => {
test('API successfully updates Band with the ID of 1', async () => {
const band = { band_name: 'Opeth', genre: 'Progressive and Death Metal' };
const response = await request(server).put('/api/bands/1').send(band);
expect(response.status).toBe(200);
});
});

describe('POST to /api/bands', () => {
test('API successfully creates a new band', async () => {
const band = { band_name: 'Anderson Paak', genre: 'Multiple' };
const response = await request(server).post('/api/bands').send(band);
expect(response.status).toBe(201);
});
});