Skip to content

Commit

Permalink
test: should return bad request API version validations
Browse files Browse the repository at this point in the history
  • Loading branch information
sjdonado committed Oct 19, 2023
1 parent 277df82 commit 2dc71f8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/integration/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,5 +828,29 @@ describe('Api router', () => {
message: 'Invalid spotify link',
});
});

it('should return bad request - unsupported API version', async () => {
const request = JSONRequest(`${API_ENDPOINT}/search?v=1`, {
spotifyLink: cachedSpotifyLink,
});
const response = await app.handle(request).then(res => res.json());

expect(response).toEqual({
code: 'VALIDATION',
message: 'Unsupported API version',
});
});

it('should return bad request - missing API version query param', async () => {
const request = JSONRequest(`${API_ENDPOINT}/search`, {
spotifyLink: cachedSpotifyLink,
});
const response = await app.handle(request).then(res => res.json());

expect(response).toEqual({
code: 'VALIDATION',
message: 'Unsupported API version',
});
});
});
});

0 comments on commit 2dc71f8

Please sign in to comment.