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

Commit 060adae

Browse files
authored
test case fix
1 parent 87ca2ff commit 060adae

File tree

1 file changed

+113
-137
lines changed

1 file changed

+113
-137
lines changed

src/hooks/useDynamicImportJSON/__tests__/useDynamicImport.test.tsx

Lines changed: 113 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -129,157 +129,133 @@ describe("useDynamicImportJSON", () => {
129129
it("should have correct text area inputs inside dynamic imports correctly", () => {
130130
act(() => {
131131
result.current.dynamicImportJSON(result.current.text_data.selected_value);
132+
console.log(result.current.request_info);
132133
});
133134
expect(result.current.request_info).toEqual({
134135
$schema: "http://json-schema.org/draft-04/schema#",
135-
title: "Active Symbols (response)",
136-
description: "A message containing the list of active symbols.",
137-
type: "object",
138-
required: ["echo_req", "msg_type"],
139-
properties: {
140-
active_symbols: {
141-
title: "active_symbols",
142-
description: "List of active symbols.",
143-
type: "array",
144-
items: {
145-
description: "The information about each symbol.",
146-
type: "object",
147-
additionalProperties: false,
148-
required: [
149-
"display_name",
150-
"display_order",
151-
"exchange_is_open",
152-
"is_trading_suspended",
153-
"market",
154-
"market_display_name",
155-
"pip",
156-
"subgroup",
157-
"subgroup_display_name",
158-
"submarket",
159-
"submarket_display_name",
160-
"symbol",
161-
"symbol_type",
136+
additionalProperties: false,
137+
auth_required: 0,
138+
default: {
139+
$schema: "http://json-schema.org/draft-04/schema#",
140+
additionalProperties: false,
141+
auth_required: 0,
142+
description:
143+
"Retrieve a list of all currently active symbols (underlying markets upon which contracts are available for trading).",
144+
properties: {
145+
active_symbols: {
146+
description:
147+
"If you use `brief`, only a subset of fields will be returned.",
148+
enum: ["brief", "full"],
149+
type: "string",
150+
},
151+
landing_company: {
152+
description: "Deprecated - replaced by landing_company_short.",
153+
enum: [
154+
"iom",
155+
"malta",
156+
"maltainvest",
157+
"svg",
158+
"virtual",
159+
"vanuatu",
160+
"champion",
161+
"champion-virtual",
162+
],
163+
type: "string",
164+
},
165+
landing_company_short: {
166+
description:
167+
"[Optional] If you specify this field, only symbols available for trading by that landing company will be returned. If you are logged in, only symbols available for trading by your landing company will be returned regardless of what you specify in this field.",
168+
enum: [
169+
"iom",
170+
"malta",
171+
"maltainvest",
172+
"svg",
173+
"virtual",
174+
"vanuatu",
175+
"champion",
176+
"champion-virtual",
162177
],
163-
properties: {
164-
allow_forward_starting: {
165-
description:
166-
"`1` if the symbol is tradable in a forward starting contract, `0` if not.",
167-
type: "integer",
168-
enum: [0, 1],
169-
},
170-
delay_amount: {
171-
description:
172-
"Amount the data feed is delayed (in minutes) due to Exchange licensing requirements. Only returned on `full` active symbols call.",
173-
type: "integer",
174-
},
175-
display_name: {
176-
description: "Display name.",
177-
type: "string",
178-
},
179-
display_order: {
180-
description: "Display order.",
181-
type: "integer",
182-
},
183-
exchange_is_open: {
184-
description: "`1` if market is currently open, `0` if closed.",
185-
type: "integer",
186-
enum: [0, 1],
187-
},
188-
exchange_name: {
189-
description:
190-
"Exchange name (for underlyings listed on a Stock Exchange). Only returned on `full` active symbols call.",
191-
type: "string",
192-
},
193-
intraday_interval_minutes: {
194-
description:
195-
"Intraday interval minutes. Only returned on `full` active symbols call.",
196-
type: "integer",
197-
},
198-
is_trading_suspended: {
199-
description:
200-
"`1` indicates that trading is currently suspended, `0` if not.",
201-
type: "integer",
202-
enum: [0, 1],
203-
},
204-
market: {
205-
description: "Market category (forex, indices, etc).",
206-
type: "string",
207-
},
208-
market_display_name: {
209-
description: "Translated market name.",
210-
type: "string",
211-
},
212-
pip: {
213-
description: "Pip size (i.e. minimum fluctuation amount).",
214-
type: "number",
215-
},
216-
quoted_currency_symbol: {
217-
description:
218-
"For stock indices, the underlying currency for that instrument. Only returned on `full` active symbols call.",
219-
type: "string",
220-
},
221-
spot: {
222-
description:
223-
"Latest spot price of the underlying. Only returned on `full` active symbols call.",
224-
type: ["null", "number"],
225-
},
226-
spot_age: {
227-
description:
228-
"Number of seconds elapsed since the last spot price. Only returned on `full` active symbols call.",
229-
type: "string",
230-
},
231-
spot_percentage_change: {
232-
description:
233-
"Daily percentage for a symbol. Only returned on 'full' active symbols call.",
234-
type: "string",
235-
},
236-
spot_time: {
237-
description:
238-
"Latest spot epoch time. Only returned on `full` active symbols call.",
239-
type: "string",
240-
},
241-
subgroup: {
242-
description: "Subgroup name.",
243-
type: "string",
244-
},
245-
subgroup_display_name: {
246-
description: "Translated subgroup name.",
247-
type: "string",
248-
},
249-
submarket: {
250-
description: "Submarket name.",
251-
type: "string",
252-
},
253-
submarket_display_name: {
254-
description: "Translated submarket name.",
255-
type: "string",
256-
},
257-
symbol: {
258-
description: "The symbol code for this underlying.",
259-
type: "string",
260-
},
261-
symbol_type: {
262-
description: "Symbol type (forex, commodities, etc).",
263-
type: "string",
264-
},
265-
},
178+
type: "string",
266179
},
180+
passthrough: {
181+
description:
182+
"[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field. Maximum size is 3500 bytes.",
183+
maxSize: 3500,
184+
type: "object",
185+
},
186+
product_type: {
187+
description:
188+
"[Optional] If you specify this field, only symbols that can be traded through that product type will be returned.",
189+
enum: ["basic"],
190+
type: "string",
191+
},
192+
req_id: {
193+
description: "[Optional] Used to map request to response.",
194+
type: "integer",
195+
},
196+
},
197+
required: ["active_symbols"],
198+
title: "Active Symbols (request)",
199+
type: "object",
200+
},
201+
description:
202+
"Retrieve a list of all currently active symbols (underlying markets upon which contracts are available for trading).",
203+
properties: {
204+
active_symbols: {
205+
description:
206+
"If you use `brief`, only a subset of fields will be returned.",
207+
enum: ["brief", "full"],
208+
type: "string",
267209
},
268-
echo_req: {
269-
description: "Echo of the request made.",
210+
landing_company: {
211+
description: "Deprecated - replaced by landing_company_short.",
212+
enum: [
213+
"iom",
214+
"malta",
215+
"maltainvest",
216+
"svg",
217+
"virtual",
218+
"vanuatu",
219+
"champion",
220+
"champion-virtual",
221+
],
222+
type: "string",
223+
},
224+
landing_company_short: {
225+
description:
226+
"[Optional] If you specify this field, only symbols available for trading by that landing company will be returned. If you are logged in, only symbols available for trading by your landing company will be returned regardless of what you specify in this field.",
227+
enum: [
228+
"iom",
229+
"malta",
230+
"maltainvest",
231+
"svg",
232+
"virtual",
233+
"vanuatu",
234+
"champion",
235+
"champion-virtual",
236+
],
237+
type: "string",
238+
},
239+
passthrough: {
240+
description:
241+
"[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field. Maximum size is 3500 bytes.",
242+
maxSize: 3500,
270243
type: "object",
271244
},
272-
msg_type: {
273-
description: "Action name of the request made.",
245+
product_type: {
246+
description:
247+
"[Optional] If you specify this field, only symbols that can be traded through that product type will be returned.",
248+
enum: ["basic"],
274249
type: "string",
275-
enum: ["active_symbols"],
276250
},
277251
req_id: {
278-
description:
279-
"Optional field sent in request to map to response, present only when request contains `req_id`.",
252+
description: "[Optional] Used to map request to response.",
280253
type: "integer",
281254
},
282255
},
256+
required: ["active_symbols"],
257+
title: "Active Symbols (request)",
258+
type: "object",
283259
});
284260
});
285261
});

0 commit comments

Comments
 (0)