Skip to content

Commit

Permalink
Added two more test to cover exception cases
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaro-mota-funttastic committed Oct 24, 2023
1 parent da4b091 commit f3ae8a4
Showing 1 changed file with 52 additions and 5 deletions.
57 changes: 52 additions & 5 deletions test-bronze/connectors/kujira/kujira.controllers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ import express from 'express';
import { Express } from 'express-serve-static-core';
import data from './fixtures/patches/data';

// enablePatches();
disablePatches();
enablePatches();
// disablePatches();

// enableInputOutputWrapper();
// disableInputOutputWrapper();
disableInputOutputWrapper();

// const requestStrategy = RequestStrategy.RESTful;
const requestStrategy = RequestStrategy.Controller;
Expand Down Expand Up @@ -4822,7 +4822,7 @@ describe('Kujira', () => {
});

describe('Exceptions', () => {
it('Generate Exception TokenNotFound', async () => {
it.skip('Generate TokenNotFound Exception (token)', async () => {
const requestBody = {
name: 'KUJ',
} as GetTokenRequest;
Expand All @@ -4846,7 +4846,7 @@ describe('Kujira', () => {
}
});

it('Generate MarketNotFoundError Exception', async () => {
it.skip('Generate MarketNotFoundError Exception', async () => {
const requestBody = {
ownerAddress: ownerAddress,
} as MarketsWithdrawsRequest;
Expand All @@ -4868,5 +4868,52 @@ describe('Kujira', () => {
expect(e).toEqual(new MarketNotFoundError('No market informed.'));
}
});

it.skip('Generate TokenNotFoundError Exception (tokens)', async () => {
const requestBody = {
names: ['KUJ', tokensIds[3]],
} as GetTokensRequest;

const request = {
...commonRequestBody,
...requestBody,
};

logRequest(request);
try {
await sendRequest<GetTokensResponse>({
RESTMethod: RESTfulMethod.GET,
RESTRoute: '/tokens',
RESTRequest: request,
controllerFunction: KujiraController.getTokens,
});
} catch (exception) {
expect(true).toBeTrue();
}
});

it('Generate Exception in getMarket', async () => {
const requestBody = {
name: 'KUJX/USK',
} as GetMarketRequest;

const request = {
...commonRequestBody,
...requestBody,
};

logRequest(request);

try {
await sendRequest<GetMarketResponse>({
RESTMethod: RESTfulMethod.GET,
RESTRoute: '/market',
RESTRequest: request,
controllerFunction: KujiraController.getMarket,
});
} catch (exception) {
expect(true).toBeTrue();
}
});
});
});

0 comments on commit f3ae8a4

Please sign in to comment.