Skip to content

Commit

Permalink
getTicketPrice.ts-GET (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjadach-iv authored Oct 31, 2024
1 parent bc34105 commit d70360f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/api/network/getTicketPrice.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('test pingPeer', function () {
});
it('handles successful response', async function () {
nock(API_ENDPOINT)
.post(`/api/v3/network/price`)
.get(`/api/v3/network/price`)
.reply(200, {
price: '1000000'
} as GetTicketPriceResponseType);
Expand All @@ -25,7 +25,7 @@ describe('test pingPeer', function () {
expect(response.price).toEqual('1000000');
});
it('throws a custom error when hoprd api response is an 400 error', async function () {
nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(400, {
nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(400, {
status: 'INVALID_PEERID'
});

Expand All @@ -37,7 +37,7 @@ describe('test pingPeer', function () {
).rejects.toThrow(sdkApiError);
});
it('throws a custom error when hoprd api response is an 401 error', async function () {
nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(401, {
nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(401, {
status: 'string',
error: 'string'
});
Expand All @@ -50,7 +50,7 @@ describe('test pingPeer', function () {
).rejects.toThrow(sdkApiError);
});
it('throws a custom error when hoprd api response is an 403 error', async function () {
nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(403, {
nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(403, {
status: 'string',
error: 'string'
});
Expand All @@ -63,7 +63,7 @@ describe('test pingPeer', function () {
).rejects.toThrow(sdkApiError);
});
it('throws a custom error when hoprd api response is an 422 error', async function () {
nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(422, {
nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(422, {
status: 'UNKNOWN_FAILURE',
error: 'Full error message.'
});
Expand Down
2 changes: 1 addition & 1 deletion src/api/network/getTicketPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getTicketPrice = async (
const rawResponse = await fetchWithTimeout(
`${apiEndpointParsed}api/v3/network/price`,
{
method: 'POST',
method: 'GET',
headers: getHeaders(payload.apiToken)
},
payload.timeout
Expand Down

0 comments on commit d70360f

Please sign in to comment.