Skip to content

Commit

Permalink
Update mex.token.charts.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
cfaur09 committed Sep 19, 2024
1 parent 4d35e07 commit effa663
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/test/unit/services/mex.token.charts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('MexTokenChartsService', () => {
],
};


jest.spyOn(graphQlService, 'getExchangeServiceData').mockResolvedValue(mockData);
jest.spyOn(mexTokenService, 'getMexTokenByIdentifier').mockResolvedValue(mockToken);
jest.spyOn(mexTokenChartsService as any, 'checkTokenExists').mockReturnValue(true);

const result = await mexTokenChartsService.getTokenPricesHourResolutionRaw('TOKEN-123456');

Expand All @@ -69,14 +69,7 @@ describe('MexTokenChartsService', () => {

it('should return an empty array when no data is available', async () => {
jest.spyOn(graphQlService, 'getExchangeServiceData').mockResolvedValue({});

const result = await mexTokenChartsService.getTokenPricesHourResolutionRaw('TOKEN-123456');

expect(result).toEqual([]);
});

it('should return an empty array when an error occurs', async () => {
jest.spyOn(graphQlService, 'getExchangeServiceData').mockRejectedValue(new Error('GraphQL error'));
jest.spyOn(mexTokenChartsService as any, 'checkTokenExists').mockReturnValue(true);

const result = await mexTokenChartsService.getTokenPricesHourResolutionRaw('TOKEN-123456');

Expand All @@ -97,6 +90,7 @@ describe('MexTokenChartsService', () => {

jest.spyOn(graphQlService, 'getExchangeServiceData').mockResolvedValue(mockData);
jest.spyOn(mexTokenService, 'getMexTokenByIdentifier').mockResolvedValue(mockToken);
jest.spyOn(mexTokenChartsService as any, 'checkTokenExists').mockReturnValue(true);

const result = await mexTokenChartsService.getTokenPricesDayResolutionRaw('TOKEN-123456', '1683561648');

Expand All @@ -108,15 +102,7 @@ describe('MexTokenChartsService', () => {

it('should return an empty array when no data is available', async () => {
jest.spyOn(graphQlService, 'getExchangeServiceData').mockResolvedValue({});

const result = await mexTokenChartsService.getTokenPricesDayResolutionRaw('TOKEN-123456', '1683561648');

expect(result).toEqual([]);
});

it('should return an empty array when an error occurs', async () => {
jest.spyOn(graphQlService, 'getExchangeServiceData').mockRejectedValue(new Error('GraphQL error'));

jest.spyOn(mexTokenChartsService as any, 'checkTokenExists').mockReturnValue(true);
const result = await mexTokenChartsService.getTokenPricesDayResolutionRaw('TOKEN-123456', '1683561648');

expect(result).toEqual([]);
Expand Down

0 comments on commit effa663

Please sign in to comment.