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

Commit 67f1b1a

Browse files
committed
fix: code implementation change
1 parent 4ace2fd commit 67f1b1a

File tree

5 files changed

+7
-19
lines changed

5 files changed

+7
-19
lines changed

src/configs/websocket/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class ApiManager {
4040
}
4141

4242
public augmentedSend<T extends TSocketEndpointNames>(
43-
request?: TSocketRequestProps<T> extends never ? undefined : TSocketRequestProps<T>,
43+
request: TSocketRequestProps<T> extends never ? undefined : TSocketRequestProps<T>,
4444
): Promise<TSocketResponse<T>> {
4545
return this.derivApi.send(request) as Promise<TSocketResponse<T>>;
4646
}

src/features/Apiexplorer/RequestJSONBox/__tests__/RequestJsonBox.test.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,6 @@ describe('RequestResponseRenderer', () => {
8686
expect(placeholder).toHaveLength(1);
8787
});
8888

89-
it('should disable text box if no api call is selected in the dropdown', () => {
90-
const newProps = {
91-
handleChange: jest.fn(),
92-
request_example: '',
93-
name: null as TSocketEndpointNames,
94-
auth: 0,
95-
};
96-
render(<RequestJSONBox {...newProps} />);
97-
const textarea = screen.getByLabelText('Request JSON');
98-
expect(textarea).toBeDisabled();
99-
});
100-
10189
it('should disable text box if no api call is selected in the dropdown', async () => {
10290
const newProps = {
10391
handleChange: jest.fn(),

src/hooks/useSubscription/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const useSubscription = <T extends TSocketSubscribableEndpointNames>(name: T) =>
3636
}, []);
3737

3838
const subscribe = useCallback(
39-
(data: Parameters<typeof apiManager.augmentedSubscribe<T>>[]) => {
40-
let payload: any = data;
39+
(data: Parameters<typeof apiManager.augmentedSubscribe<T>>[0]) => {
40+
let payload = data;
4141
if (name) {
4242
payload = { [name]: 1, subscribe: 1, ...payload };
4343
} else {

src/hooks/useWs/__tests__/useWs.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Use WS', () => {
6060
expect(result.current.error).toBeUndefined();
6161

6262
await expect(wsServer).toReceiveMessage({
63-
active_symbols: 1,
63+
active_symbols: 'brief',
6464
product_type: 'basic',
6565
req_id: 1,
6666
});
@@ -168,7 +168,7 @@ describe('Use WS', () => {
168168
expect(result.current.error).toBeUndefined();
169169

170170
await expect(wsServer).toReceiveMessage({
171-
active_symbols: 1,
171+
active_symbols: 'brief',
172172
product_type: 'basic',
173173
req_id: 1,
174174
});

src/hooks/useWs/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const useWS = <T extends TSocketEndpointNames>(name?: T) => {
1919
}, []);
2020

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

2626
if (name) {

0 commit comments

Comments
 (0)