Thanks to visit codestin.com
Credit goes to github.com

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

Commit 7b88122

Browse files
Hubert KosterHubert Koster
Hubert Koster
authored and
Hubert Koster
committed
chore: fixing merge conflict
2 parents 33b02ce + 2e6b28d commit 7b88122

File tree

27 files changed

+487
-214
lines changed

27 files changed

+487
-214
lines changed

docs/faq/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"label": "Frequently Asked Questions",
2+
"label": "FAQ",
33
"position": 6,
44
"link": {
55
"type": "generated-index"

docs/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Our Documentation is divided in several sections:
99
- [Setting up a deriv app](/docs/application_setup.md)
1010
- [Core Concepts](category/core-concepts)
1111
- [Languages](category/languages)
12-
- [Client libraries](category/client-libraries)
13-
- [Frequently Asked Questions](category/frequently-asked-questions)
12+
- [Client Libraries](category/client-libraries)
13+
- [FAQ](category/faq)
1414
- [Guides](category/guides)
1515

1616
### Quick Start

src/components/Footer/Footer.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
align-items: center;
2020
gap: rem(1);
2121
.FooterContent {
22+
font-family: 'Ubuntu', sans-serif;
2223
color: var(--ifm-color-white);
2324
@media screen and (max-width: 992px) {
2425
font-size: rem(2);
@@ -37,6 +38,7 @@
3738
padding: 0 rem(0.5);
3839
}
3940
.communityButton {
41+
font-family: 'Ubuntu', sans-serif;
4042
color: var(--ifm-color-white);
4143
border: 2px solid var(--ifm-color-secondary-darkest);
4244
padding: rem(0.5);

src/configs/cms/collections/deriv-api.collection.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/configs/cms/collections/frameworks.collection.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/configs/cms/collections/guides.collection.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/configs/cms/collections/index.ts

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import type { CmsCollection } from 'netlify-cms-core';
2-
import { CONCEPTS_COLLECTION_NAME, FAQ_POST_COLLECTION_NAME } from '../constants';
3-
import derivapi_clients_collection from './deriv-api.collection';
2+
import {
3+
CLIENT_LIBRARIES_COLLECTION_NAME,
4+
CONCEPTS_COLLECTION_NAME,
5+
FAQ_POST_COLLECTION_NAME,
6+
FRAMEWORKS_COLLECTION_NAME,
7+
GUIDES_COLLECTION_NAME,
8+
LANGUAGES_COLLECTION_NAME,
9+
TERMINOLOGY_COLLECTION_NAME,
10+
} from '../constants';
411
import DocCollection from './docs-collection.class';
5-
import frameworks_collections from './frameworks.collection';
6-
import guides_collection from './guides.collection';
7-
import languages_collections from './languages.collection';
812
import SinglePagesCollection from './singlepages.collection';
913

1014
const faq_collection: CmsCollection = new DocCollection(
@@ -21,12 +25,48 @@ const core_concepts_collection: CmsCollection = new DocCollection(
2125
'docs/core-concepts',
2226
);
2327

28+
const terminology_collection: CmsCollection = new DocCollection(
29+
TERMINOLOGY_COLLECTION_NAME,
30+
'Terminologies',
31+
'Terminology',
32+
'docs/terminology',
33+
);
34+
35+
const languages_collection: CmsCollection = new DocCollection(
36+
LANGUAGES_COLLECTION_NAME,
37+
'Languages',
38+
'Language',
39+
'docs/languages',
40+
);
41+
42+
const frameworks_collection: CmsCollection = new DocCollection(
43+
FRAMEWORKS_COLLECTION_NAME,
44+
'Frameworks',
45+
'Framework',
46+
'docs/frameworks',
47+
);
48+
49+
const client_libraries_collection: CmsCollection = new DocCollection(
50+
CLIENT_LIBRARIES_COLLECTION_NAME,
51+
'Client Libraries',
52+
'Client Librariy',
53+
'docs/client-libraries',
54+
);
55+
56+
const guides_collection: CmsCollection = new DocCollection(
57+
GUIDES_COLLECTION_NAME,
58+
'Guides',
59+
'Guide',
60+
'docs/guides',
61+
);
62+
2463
const cms_collections: CmsCollection[] = [
2564
SinglePagesCollection,
65+
terminology_collection,
2666
core_concepts_collection,
27-
...languages_collections,
28-
...frameworks_collections,
29-
...derivapi_clients_collection,
67+
languages_collection,
68+
frameworks_collection,
69+
client_libraries_collection,
3070
guides_collection,
3171
faq_collection,
3272
];

src/configs/cms/collections/languages.collection.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/configs/cms/collections/singlepages.collection.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,16 @@ const SinglePagesCollection: CmsCollection = {
1212
file: 'docs/intro.md',
1313
fields: [...default_doc_fields],
1414
},
15-
{
16-
name: 'app_reg',
17-
label: 'Application Setup',
18-
file: 'docs/application_setup.md',
19-
fields: [...default_doc_fields],
20-
},
2115
{
2216
name: 'language-intro',
2317
label: 'Language Introduction',
2418
file: 'docs/languages/intro.md',
2519
fields: [...default_doc_fields],
2620
},
2721
{
28-
name: 'dervi-api-intro',
29-
label: 'Deriv API Introduction',
30-
file: 'docs/deriv-api/intro.md',
22+
name: 'client-libraries-intro',
23+
label: 'Client Libraries Introduction',
24+
file: 'docs/client-libraries/intro.md',
3125
fields: [...default_doc_fields],
3226
},
3327
{
@@ -37,9 +31,9 @@ const SinglePagesCollection: CmsCollection = {
3731
fields: [...default_doc_fields],
3832
},
3933
{
40-
name: 'guides-intro',
41-
label: 'Guides Introduction',
42-
file: 'docs/guides/intro.md',
34+
name: 'app_reg',
35+
label: 'Application Setup',
36+
file: 'docs/application_setup.md',
4337
fields: [...default_doc_fields],
4438
},
4539
],

src/configs/cms/constants/index.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
export const BLOG_POST_COLLECTION_NAME = 'blog-post';
22
export const FAQ_POST_COLLECTION_NAME = 'faqs';
33
export const CONCEPTS_COLLECTION_NAME = 'concepts';
4-
5-
// LANGUAGES
6-
export const JS_LANG_COLLECTION_NAME = 'js-lang-docs';
7-
export const TS_LANG_COLLECTION_NAME = 'ts-lang-docs';
8-
export const DART_LANG_COLLECTION_NAME = 'dart-lang-docs';
9-
export const PYTHON_LANG_COLLECTION_NAME = 'python-lang-docs';
10-
11-
// FRAMEWORKS
12-
export const REACT_FRAMEWORK_COLLECTION_NAME = 'react-framework-docs';
13-
export const ANGULAR_FRAMEWORK_COLLECTION_NAME = 'angular-framework-docs';
14-
export const SOLIDJS_FRAMEWORK_COLLECTION_NAME = 'solidjs-framework-docs';
15-
export const SVELTE_FRAMEWORK_COLLECTION_NAME = 'svelte-framework-docs';
16-
export const VUE_FRAMEWORK_COLLECTION_NAME = 'vue-framework-docs';
17-
18-
// CLIENTS
19-
export const TS_CLIENT_COLLECTION_NAME = 'ts-client-docs';
20-
export const PYTHON_CLIENT_COLLECTION_NAME = 'python-client-docs';
21-
export const FLUTTER_CLIENT_COLLECTION_NAME = 'flutter-client-docs';
22-
23-
// GUIDES
24-
export const GUIDES_COLLECTION_NAME = 'guides-docs';
4+
export const TERMINOLOGY_COLLECTION_NAME = 'terminology';
5+
export const LANGUAGES_COLLECTION_NAME = 'languages';
6+
export const FRAMEWORKS_COLLECTION_NAME = 'frameworks';
7+
export const CLIENT_LIBRARIES_COLLECTION_NAME = 'clientlibraries';
8+
export const GUIDES_COLLECTION_NAME = 'guides';
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import React from 'react';
2+
import '@testing-library/jest-dom';
3+
import { cleanup, getByPlaceholderText, render, screen, waitFor } from '@testing-library/react';
4+
import { TSocketEndpointNames } from '@site/src/configs/websocket/types';
5+
import useAuthContext from '@site/src/hooks/useAuthContext';
6+
import { IAuthContext } from '@site/src/contexts/auth/auth.context';
7+
import userEvent from '@testing-library/user-event';
8+
import RequestJSONBox from '..';
9+
10+
jest.mock('@site/src/hooks/useAuthContext');
11+
12+
const mockUseAuthContext = useAuthContext as jest.MockedFunction<() => Partial<IAuthContext>>;
13+
14+
describe('RequestResponseRenderer', () => {
15+
const mockProps = {
16+
handleChange: jest.fn(),
17+
request_example: '{"app_list": 1}',
18+
name: 'app_list' as TSocketEndpointNames,
19+
auth_required: 0,
20+
};
21+
22+
beforeEach(() => {
23+
mockUseAuthContext.mockImplementation(() => {
24+
return {
25+
is_logged_in: true,
26+
};
27+
});
28+
render(<RequestJSONBox {...mockProps} />);
29+
});
30+
31+
afterEach(() => {
32+
cleanup();
33+
jest.clearAllMocks();
34+
});
35+
36+
it('should render textarea', () => {
37+
const newProps = {
38+
handleChange: jest.fn(),
39+
request_example: '',
40+
name: '' as TSocketEndpointNames,
41+
auth_required: 0,
42+
};
43+
cleanup();
44+
render(<RequestJSONBox {...newProps} />);
45+
const textarea = screen.getByLabelText('Request JSON');
46+
const placeholder = screen.getAllByPlaceholderText('Request JSON');
47+
expect(textarea).toBeInTheDocument();
48+
expect(placeholder).toHaveLength(1);
49+
});
50+
51+
it('should render response renderer component', async () => {
52+
const primaryButton = screen.getByRole('button', { name: /Send Request/i });
53+
const secondaryButton = screen.getByRole('button', { name: /clear/i });
54+
await userEvent.click(primaryButton);
55+
const playgroundSection = screen.getByTestId('playground-section');
56+
expect(playgroundSection).toBeInTheDocument();
57+
expect(primaryButton).toBeInTheDocument();
58+
expect(secondaryButton).toBeInTheDocument();
59+
});
60+
it('should show request api json of the call selected from dropdown inside the text area', async () => {
61+
const textarea = screen.getByPlaceholderText('Request JSON');
62+
expect(textarea).toBeInTheDocument();
63+
expect(textarea).toHaveValue('{"app_list": 1}');
64+
});
65+
});

0 commit comments

Comments
 (0)