Skip to content

Commit

Permalink
Removes end slash when not getting wait times for a specific location
Browse files Browse the repository at this point in the history
  • Loading branch information
craigpaul committed Sep 14, 2021
1 parent c6e293b commit 2d2cc5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/resources/wait-time.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ it('will set the page we are on', async () => {
await resource.on(4).get();

expect(resource.on(4)).toHaveProperty('page', 4);
expect(mockAxios.get).toHaveBeenCalledWith('wait-time-average/', { params: { 'page': 4 } });
expect(mockAxios.get).toHaveBeenCalledWith('wait-time-average', { params: { 'page': 4 } });
});

it('will set the limit given', async () => {
Expand All @@ -26,7 +26,7 @@ it('will set the limit given', async () => {
await resource.take(5).get();

expect(resource.take(5)).toHaveProperty('limit', 5);
expect(mockAxios.get).toHaveBeenCalledWith('wait-time-average/', { params: { 'limit': 5 } });
expect(mockAxios.get).toHaveBeenCalledWith('wait-time-average', { params: { 'limit': 5 } });
});

it('can get wait times without additional parameters', async () => {
Expand All @@ -35,5 +35,5 @@ it('can get wait times without additional parameters', async () => {
await resource.get();

expect(mockAxios.get).toHaveBeenCalledTimes(1);
expect(mockAxios.get).toHaveBeenCalledWith('wait-time-average/', { params: {} });
expect(mockAxios.get).toHaveBeenCalledWith('wait-time-average', { params: {} });
});
2 changes: 1 addition & 1 deletion src/resources/wait-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class WaitTime extends Conditional implements WaitTimeResource {
params.page = this.page;
}

return await this.client.get(`wait-time-average/${location}`, { params });
return await this.client.get(location ? `wait-time-average/${location}` : 'wait-time-average', { params });
}

public at(location: string | number): this {
Expand Down

0 comments on commit 2d2cc5c

Please sign in to comment.