Skip to content

Commit

Permalink
fix api service kyve test
Browse files Browse the repository at this point in the history
  • Loading branch information
bz888 committed Apr 17, 2024
1 parent f37102a commit 3ba4fa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/node/src/indexer/api.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
NodeConfig,
} from '@subql/node-core';
import { GraphQLSchema } from 'graphql';
import { CosmosNodeConfig } from '../configure/NodeConfig';
import Pino from 'pino';
import { SubqueryProject } from '../configure/SubqueryProject';
import { LazyBlockContent } from '../utils/cosmos';
import { ApiService } from './api.service';
Expand Down Expand Up @@ -99,9 +99,7 @@ describe('ApiService', () => {
});

it('Able to fetch with cached promises and remove cached bundle files', async () => {
jest
.spyOn(apiService as any, 'retryFetch')
.mockRejectedValue('Disabled rpc for kyve testing');
const rpcFetchSpy = jest.spyOn(apiService as any, 'retryFetch');

const heights_1 = [150, 300, 1, 301, 450, 550];
const heights_2 = [498, 600, 801, 1100];
Expand All @@ -117,6 +115,8 @@ describe('ApiService', () => {
});

const files = await fs.promises.readdir(tmpPath);

expect(rpcFetchSpy).toHaveBeenCalledTimes(0);
expect(files).not.toContain('bundle_0.json');
expect(files).not.toContain('bundle_1.json');
});
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/utils/kyve/kyve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ describe('KyveApi', () => {
const files = await fs.promises.readdir(tmpPath);
expect(files.length).toBe(0);
});
it('ensure to remove logic', () => {
it('ensure to remove logic', async () => {
const cachedBundleDetails = [
{ id: '0', from_key: '1', to_key: '150' },
{ id: '1', from_key: '151', to_key: '300' },
Expand All @@ -320,7 +320,7 @@ describe('KyveApi', () => {
const height = 650;
const bufferSize = 300;

const toRemoveBundles = (kyveApi as any).getToRemoveBundles(
const toRemoveBundles = await (kyveApi as any).getToRemoveBundles(
cachedBundleDetails,
height,
bufferSize,
Expand Down

0 comments on commit 3ba4fa1

Please sign in to comment.