From a0d709669e3d33497c0c5f9b7b2ae74126f70853 Mon Sep 17 00:00:00 2001 From: Kai Hirota <34954529+kaihirota@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:20:17 +1100 Subject: [PATCH] make starkex contract version func private --- src/workflows/workflows.test.ts | 39 --------------------------------- src/workflows/workflows.ts | 2 +- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 src/workflows/workflows.test.ts diff --git a/src/workflows/workflows.test.ts b/src/workflows/workflows.test.ts deleted file mode 100644 index f85809fd..00000000 --- a/src/workflows/workflows.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Config } from '../config'; - -import axios from 'axios'; -import { Workflows } from './workflows'; - -jest.mock('axios'); -const mockedAxios = axios as jest.Mocked; - -describe('getContractVersion', () => { - afterEach(() => { - jest.clearAllMocks(); - }); - - it('should return contract version 3.0.3', async () => { - mockedAxios.get.mockImplementation(async path => { - if (path.includes('starkex-contract-version')) { - return { - data: { version: '3.0.3', message: 'test' }, - }; - } - return { data: undefined }; - }); - - const workflows = new Workflows(Config.SANDBOX); - const contractVersion = await workflows.getStarkExContractVersion(); - expect(contractVersion.data.version).toEqual('3.0.3'); - }); - - it('should throw error on 404 response', async () => { - mockedAxios.get.mockRejectedValueOnce( - new Error('Request failed with status code 404'), - ); - - const workflows = new Workflows(Config.SANDBOX); - await expect(workflows.getStarkExContractVersion()).rejects.toThrowError( - new Error('Request failed with status code 404'), - ); - }); -}); diff --git a/src/workflows/workflows.ts b/src/workflows/workflows.ts index e2c27172..71f3e780 100644 --- a/src/workflows/workflows.ts +++ b/src/workflows/workflows.ts @@ -180,7 +180,7 @@ export class Workflows { }); } - public async getStarkExContractVersion(): Promise< + private async getStarkExContractVersion(): Promise< AxiosResponse > { const options = {