From ea317ecb4f2c837acf6ccdc441005e1d1bfd98aa Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 22:48:44 +0100 Subject: [PATCH] fix: delete post bounty test --- src/network/postBounty/__tests__/index.ts | 63 ----------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/network/postBounty/__tests__/index.ts diff --git a/src/network/postBounty/__tests__/index.ts b/src/network/postBounty/__tests__/index.ts deleted file mode 100644 index a38360583..000000000 --- a/src/network/postBounty/__tests__/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { getTribeUserDetails, getWorkspace, postBountyData } from '..' -import { TRIBE_BASE_URL } from '../../../utils/constants/index' -import { api } from '../../api' - -// Successfully retrieves user details with a valid pubkey -it('should return user details when given a valid pubkey', async () => { - const mockPubkey = 'validPubkey123' - const mockResponse = { - id: 1, - uuid: 'uuid-123', - unique_name: 'uniqueName', - owner_alias: 'ownerAlias', - } - - jest.spyOn(api, 'get').mockResolvedValue(mockResponse) - - const result = await getTribeUserDetails(mockPubkey) - - expect(result).toEqual(mockResponse) - expect(api).toHaveBeenCalledWith(`${TRIBE_BASE_URL}/person/${mockPubkey}`, { - headers: { - 'Content-Type': 'application/json', - }, - method: 'GET', - }) -}) - -// Successfully retrieves a list of workspaces for a valid user ID -it('should return a list of workspaces when given a valid user ID', async () => { - const mockResponse = [ - { name: 'Workspace1', uuid: '123' }, - { name: 'Workspace2', uuid: '456' }, - ] - jest.spyOn(api, 'get').mockResolvedValue(mockResponse) - - const result = await getWorkspace(1) - - expect(result).toEqual(mockResponse) - expect(api).toHaveBeenCalledWith('https://community.sphinx.chat/workspaces/user/1', { - headers: { 'Content-Type': 'application/json' }, - method: 'GET', - }) -}) - -// Successfully posts a valid BountyPayload and receives a positive response -it('should post valid BountyPayload and receive positive response', async () => { - const payload = { - type: 'bug', - amount: 100, - workspace_uuid: '1234-5678', - jwt_token: 'valid_token', - ref_id: 'ref123', - node_data: {}, - } - - const mockResponse = { status: 200, data: { success: true } } - jest.spyOn(api, 'post').mockResolvedValue(mockResponse) - - const response = await postBountyData(payload) - - expect(api.post).toHaveBeenCalledWith('/bounty', JSON.stringify(payload)) - expect(response).toEqual(mockResponse) -})