Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix: code implementation change
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjam-deriv committed Nov 30, 2023
1 parent 4ace2fd commit 67f1b1a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/configs/websocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ApiManager {
}

public augmentedSend<T extends TSocketEndpointNames>(
request?: TSocketRequestProps<T> extends never ? undefined : TSocketRequestProps<T>,
request: TSocketRequestProps<T> extends never ? undefined : TSocketRequestProps<T>,
): Promise<TSocketResponse<T>> {
return this.derivApi.send(request) as Promise<TSocketResponse<T>>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,6 @@ describe('RequestResponseRenderer', () => {
expect(placeholder).toHaveLength(1);
});

it('should disable text box if no api call is selected in the dropdown', () => {
const newProps = {
handleChange: jest.fn(),
request_example: '',
name: null as TSocketEndpointNames,
auth: 0,
};
render(<RequestJSONBox {...newProps} />);
const textarea = screen.getByLabelText('Request JSON');
expect(textarea).toBeDisabled();
});

it('should disable text box if no api call is selected in the dropdown', async () => {
const newProps = {
handleChange: jest.fn(),
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useSubscription/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const useSubscription = <T extends TSocketSubscribableEndpointNames>(name: T) =>
}, []);

const subscribe = useCallback(
(data: Parameters<typeof apiManager.augmentedSubscribe<T>>[]) => {
let payload: any = data;
(data: Parameters<typeof apiManager.augmentedSubscribe<T>>[0]) => {
let payload = data;
if (name) {
payload = { [name]: 1, subscribe: 1, ...payload };
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useWs/__tests__/useWs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Use WS', () => {
expect(result.current.error).toBeUndefined();

await expect(wsServer).toReceiveMessage({
active_symbols: 1,
active_symbols: 'brief',
product_type: 'basic',
req_id: 1,
});
Expand Down Expand Up @@ -168,7 +168,7 @@ describe('Use WS', () => {
expect(result.current.error).toBeUndefined();

await expect(wsServer).toReceiveMessage({
active_symbols: 1,
active_symbols: 'brief',
product_type: 'basic',
req_id: 1,
});
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useWs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const useWS = <T extends TSocketEndpointNames>(name?: T) => {
}, []);

const send = useCallback(
async (data?: Parameters<typeof apiManager.augmentedSend<T>>[]) => {
let payload: any = data;
async (data?: Parameters<typeof apiManager.augmentedSend<T>>[0]) => {
let payload = data;
console.log(payload);

if (name) {
Expand Down

0 comments on commit 67f1b1a

Please sign in to comment.