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

Dev #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions __tests__/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ describe('horses routes', () => {
return setup(pool);
});
it('should return a list of horses', async () => {
const res = await request(app).get('/Horses');
const expected = horses.map((horse) => {
return { id: horse.id, name: horse.name };
});
expect(res.body).toEqual(expected);
const resp = await request(app).get('/Horses');
expect(resp.body.length).toEqual(5);
expect(resp.body.length).toEqual(5);
});


it('/horses/:id should return hoses detail', async () => {
const res = await request(app).get('/horses/1');
const lucky = {
id: '1',
name: 'Lucky',
wins: '13',
born: '2012',
wins: 13,
born: 2012,
};
expect(res.body).toEqual(lucky);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1 class="text-lg font-semibold">HORSES API</h1>
<td class="table-cell p-3 text-center">GET</td>
<td class="table-cell p-3">Gets a list of horses' names and ids</td>
<td class="table-cell p-3">
<a href="/cats" target="_blank" class="text-blue-700"
<a href="/horses" target="_blank" class="text-blue-700"
>List Horses</a
>
</td>
Expand All @@ -41,7 +41,7 @@ <h1 class="text-lg font-semibold">HORSES API</h1>
Returns the detail about the horse matching the id in the parameter
</td>
<td class="table-cell p-3">
<a href="/cats/1" target="_blank" class="text-blue-700"
<a href="/horses/1" target="_blank" class="text-blue-700"
>Get Horse 1</a
>
</td>
Expand Down