richie 2.25.0b2.dev98__py2.py3-none-any.whl → 2.25.0b2.dev101__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of richie might be problematic. Click here for more details.
- frontend/jest/setup.ts +3 -0
- frontend/js/utils/test/render.tsx +72 -0
- frontend/js/utils/test/wrappers/IntlWrapper.tsx +23 -0
- frontend/js/utils/test/wrappers/JoanieAppWrapper.tsx +42 -0
- frontend/js/utils/test/wrappers/PresentationalAppWrapper.tsx +18 -0
- frontend/js/utils/test/wrappers/ReactQueryWrapper.tsx +16 -0
- frontend/js/utils/test/wrappers/RouterWrapper.tsx +29 -0
- frontend/js/utils/test/wrappers/types.ts +26 -0
- frontend/js/widgets/Dashboard/components/NavigateWithParams/index.spec.tsx +31 -40
- frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx +9 -17
- frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx +10 -44
- {richie-2.25.0b2.dev98.dist-info → richie-2.25.0b2.dev101.dist-info}/METADATA +1 -1
- {richie-2.25.0b2.dev98.dist-info → richie-2.25.0b2.dev101.dist-info}/RECORD +17 -10
- {richie-2.25.0b2.dev98.dist-info → richie-2.25.0b2.dev101.dist-info}/LICENSE +0 -0
- {richie-2.25.0b2.dev98.dist-info → richie-2.25.0b2.dev101.dist-info}/WHEEL +0 -0
- {richie-2.25.0b2.dev98.dist-info → richie-2.25.0b2.dev101.dist-info}/top_level.txt +0 -0
- {richie-2.25.0b2.dev98.dist-info → richie-2.25.0b2.dev101.dist-info}/zip-safe +0 -0
frontend/jest/setup.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Extend jest matchers with jest-dom's
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
|
+
import fetchMock from 'fetch-mock';
|
|
3
4
|
import { Request, Response } from 'node-fetch';
|
|
4
5
|
import { FactoryConfig } from 'utils/test/factories/factories';
|
|
5
6
|
|
|
@@ -33,4 +34,6 @@ beforeAll(() => {
|
|
|
33
34
|
|
|
34
35
|
afterEach(() => {
|
|
35
36
|
FactoryConfig.resetUniqueStore();
|
|
37
|
+
fetchMock.restore();
|
|
38
|
+
jest.clearAllMocks();
|
|
36
39
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { RenderResult, screen, render as testingLibraryRender } from '@testing-library/react';
|
|
2
|
+
import React, { ReactElement } from 'react';
|
|
3
|
+
import { Nullable } from 'types/utils';
|
|
4
|
+
import { AppWrapperProps } from './wrappers/types';
|
|
5
|
+
import { JoanieAppWrapper } from './wrappers/JoanieAppWrapper';
|
|
6
|
+
|
|
7
|
+
// ------- setup -------
|
|
8
|
+
|
|
9
|
+
type CustomRenderResult = Omit<RenderResult, 'rerender'> & {
|
|
10
|
+
elementContainer: Nullable<HTMLElement>;
|
|
11
|
+
rerender: (
|
|
12
|
+
element: ReactElement,
|
|
13
|
+
options?: Partial<Omit<AppWrapperProps, 'testingLibraryOptions'>>,
|
|
14
|
+
) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type RenderFunction = (
|
|
18
|
+
element: ReactElement,
|
|
19
|
+
options?: Partial<AppWrapperProps>,
|
|
20
|
+
) => CustomRenderResult;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* Custom render method base on react-testing-library render method.
|
|
25
|
+
* This will render {@param element} in JSDom and read options to configure context and render.
|
|
26
|
+
* It also override react-testing-library rerender method to also wrap the provided component in
|
|
27
|
+
* the same contexts.
|
|
28
|
+
*
|
|
29
|
+
* The provided {@param element} is to be wrapped in :
|
|
30
|
+
* - react router (react-router-dom)
|
|
31
|
+
* - react i18n context (react-intl)
|
|
32
|
+
* - query context (react-query)
|
|
33
|
+
*
|
|
34
|
+
* This function uses default values:
|
|
35
|
+
* options.intlOptions.locale : 'en'
|
|
36
|
+
* options.routerOptions.path : '/'
|
|
37
|
+
* options.queryOptions.client : {@see queryClient}
|
|
38
|
+
*
|
|
39
|
+
*
|
|
40
|
+
* @param element element to wrap in application contexts and test
|
|
41
|
+
* @param options options to configure and/or customize wrapped context for the test {@see RenderOptions}
|
|
42
|
+
* @returns an object with all values return by react-testing-library render methods
|
|
43
|
+
* and an other property {@property elementContainer} refering to the exact element containing the {@param element} to test
|
|
44
|
+
*
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* customRender(<SomeComponentToTest />);
|
|
48
|
+
* customRender(<SomeComponentToTest />, { wrapper: WrapperPresentationalApp });
|
|
49
|
+
*/
|
|
50
|
+
export const render: RenderFunction = (
|
|
51
|
+
element: ReactElement,
|
|
52
|
+
options?: Partial<AppWrapperProps>,
|
|
53
|
+
) => {
|
|
54
|
+
const Wrapper = options?.wrapper === undefined ? JoanieAppWrapper : options?.wrapper;
|
|
55
|
+
const renderResult = testingLibraryRender(
|
|
56
|
+
Wrapper === null ? element : <Wrapper {...options}>{element}</Wrapper>,
|
|
57
|
+
options?.testingLibraryOptions,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
...renderResult,
|
|
62
|
+
elementContainer: screen.queryByTestId('test-component-container'),
|
|
63
|
+
rerender: (
|
|
64
|
+
rerenderElement: ReactElement,
|
|
65
|
+
rerenderOptions?: Partial<Omit<AppWrapperProps, 'testingLibraryOptions'>>,
|
|
66
|
+
) => {
|
|
67
|
+
return renderResult.rerender(
|
|
68
|
+
Wrapper === null ? element : <Wrapper {...rerenderOptions}>{rerenderElement}</Wrapper>,
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentProps, PropsWithChildren } from 'react';
|
|
2
|
+
import { IntlProvider, ReactIntlErrorCode } from 'react-intl';
|
|
3
|
+
|
|
4
|
+
export interface IntlWrapperProps extends PropsWithChildren, ComponentProps<typeof IntlProvider> {}
|
|
5
|
+
|
|
6
|
+
export const IntlWrapper = ({ children, ...options }: IntlWrapperProps) => (
|
|
7
|
+
<IntlProvider
|
|
8
|
+
onError={(err) => {
|
|
9
|
+
// https://github.com/formatjs/formatjs/issues/465
|
|
10
|
+
if (
|
|
11
|
+
err.code === ReactIntlErrorCode.MISSING_TRANSLATION ||
|
|
12
|
+
err.code === ReactIntlErrorCode.MISSING_DATA
|
|
13
|
+
) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
throw err;
|
|
17
|
+
}}
|
|
18
|
+
{...options}
|
|
19
|
+
locale={options?.locale || 'en'}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</IntlProvider>
|
|
23
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CunninghamProvider } from '@openfun/cunningham-react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import fetchMock from 'fetch-mock';
|
|
4
|
+
import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider';
|
|
5
|
+
import { IntlWrapper } from './IntlWrapper';
|
|
6
|
+
import { ReactQueryWrapper } from './ReactQueryWrapper';
|
|
7
|
+
import { RouterWrapper } from './RouterWrapper';
|
|
8
|
+
import { AppWrapperProps } from './types';
|
|
9
|
+
|
|
10
|
+
export const setupJoanieSession = () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
// JoanieSessionProvider inital requests
|
|
13
|
+
fetchMock.get('https://joanie.endpoint/api/v1.0/orders/', []);
|
|
14
|
+
fetchMock.get('https://joanie.endpoint/api/v1.0/addresses/', []);
|
|
15
|
+
fetchMock.get('https://joanie.endpoint/api/v1.0/credit-cards/', []);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
nbSessionApiRequest: 3,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const JoanieSessionWrapper = ({ children }: PropsWithChildren) => {
|
|
24
|
+
return <JoanieSessionProvider>{children}</JoanieSessionProvider>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const JoanieAppWrapper = ({
|
|
28
|
+
children,
|
|
29
|
+
options,
|
|
30
|
+
}: PropsWithChildren<{ options?: AppWrapperProps }>) => {
|
|
31
|
+
return (
|
|
32
|
+
<IntlWrapper {...(options?.intlOptions || { locale: 'en' })}>
|
|
33
|
+
<CunninghamProvider>
|
|
34
|
+
<ReactQueryWrapper {...(options?.queryOptions || {})}>
|
|
35
|
+
<JoanieSessionWrapper>
|
|
36
|
+
<RouterWrapper {...options?.routerOptions}>{children}</RouterWrapper>
|
|
37
|
+
</JoanieSessionWrapper>
|
|
38
|
+
</ReactQueryWrapper>
|
|
39
|
+
</CunninghamProvider>
|
|
40
|
+
</IntlWrapper>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { CunninghamProvider } from '@openfun/cunningham-react';
|
|
3
|
+
import { IntlWrapper } from './IntlWrapper';
|
|
4
|
+
import { RouterWrapper } from './RouterWrapper';
|
|
5
|
+
import { AppWrapperProps } from './types';
|
|
6
|
+
|
|
7
|
+
export const PresentationalAppWrapper = ({
|
|
8
|
+
children,
|
|
9
|
+
options,
|
|
10
|
+
}: PropsWithChildren<{ options?: AppWrapperProps }>) => {
|
|
11
|
+
return (
|
|
12
|
+
<IntlWrapper {...(options?.intlOptions || { locale: 'en' })}>
|
|
13
|
+
<CunninghamProvider>
|
|
14
|
+
<RouterWrapper {...options?.routerOptions}>{children}</RouterWrapper>
|
|
15
|
+
</CunninghamProvider>
|
|
16
|
+
</IntlWrapper>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
import { QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
import { createTestQueryClient } from '../createTestQueryClient';
|
|
5
|
+
|
|
6
|
+
interface ReactQueryWrapperProps extends PropsWithChildren {
|
|
7
|
+
client?: QueryClient;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ReactQueryWrapper = ({ children, client }: ReactQueryWrapperProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<QueryClientProvider client={client ?? createTestQueryClient({ user: true })}>
|
|
13
|
+
{children}
|
|
14
|
+
</QueryClientProvider>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { RouteObject, RouterProvider, createMemoryRouter } from 'react-router-dom';
|
|
3
|
+
import { Maybe } from 'types/utils';
|
|
4
|
+
|
|
5
|
+
export interface RouterWrapperProps extends PropsWithChildren {
|
|
6
|
+
routes?: RouteObject[];
|
|
7
|
+
path?: string;
|
|
8
|
+
initialEntries?: Maybe<string[]>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const RouterWrapper = ({
|
|
12
|
+
children,
|
|
13
|
+
routes = [],
|
|
14
|
+
path = '/',
|
|
15
|
+
initialEntries,
|
|
16
|
+
}: RouterWrapperProps) => {
|
|
17
|
+
const router = createMemoryRouter(
|
|
18
|
+
routes.length > 0
|
|
19
|
+
? routes
|
|
20
|
+
: [
|
|
21
|
+
{
|
|
22
|
+
path,
|
|
23
|
+
element: children,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
{ initialEntries: initialEntries || [path] },
|
|
27
|
+
);
|
|
28
|
+
return <RouterProvider router={router} />;
|
|
29
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/query-core';
|
|
3
|
+
import { RenderOptions as TestingLibraryRenderOptions } from '@testing-library/react';
|
|
4
|
+
import { Nullable } from 'types/utils';
|
|
5
|
+
import { IntlWrapperProps } from './IntlWrapper';
|
|
6
|
+
import { RouterWrapperProps } from './RouterWrapper';
|
|
7
|
+
|
|
8
|
+
interface QueryOptions {
|
|
9
|
+
client: QueryClient;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Options to configure the render of a component for a test
|
|
14
|
+
*
|
|
15
|
+
* @property testingLibraryOptions options provided by react-testing-library to the render method
|
|
16
|
+
* @property intlOptions options to configure i18n context
|
|
17
|
+
* @property routerOptions options to configure router and routes in the test
|
|
18
|
+
* @property queryOptions options to configure a custom client used by react-query for a test
|
|
19
|
+
*/
|
|
20
|
+
export interface AppWrapperProps {
|
|
21
|
+
wrapper?: Nullable<(props: PropsWithChildren<{ options?: AppWrapperProps }>) => JSX.Element>;
|
|
22
|
+
intlOptions?: IntlWrapperProps;
|
|
23
|
+
queryOptions?: QueryOptions;
|
|
24
|
+
routerOptions?: RouterWrapperProps;
|
|
25
|
+
testingLibraryOptions?: TestingLibraryRenderOptions;
|
|
26
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { screen } from '@testing-library/react';
|
|
2
|
+
import { Outlet } from 'react-router-dom';
|
|
3
3
|
import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie';
|
|
4
4
|
import LocationDisplay from 'utils/test/LocationDisplay';
|
|
5
|
+
import { render } from 'utils/test/render';
|
|
6
|
+
import { RouterWrapper } from 'utils/test/wrappers/RouterWrapper';
|
|
5
7
|
import NavigateWithParams from '.';
|
|
6
8
|
|
|
7
9
|
jest.mock('utils/context', () => ({
|
|
@@ -15,46 +17,35 @@ jest.mock('utils/indirection/window', () => ({
|
|
|
15
17
|
},
|
|
16
18
|
}));
|
|
17
19
|
|
|
18
|
-
interface RenderTestRouterProps {
|
|
19
|
-
url?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const renderTestRouter = ({ url = '/myTestId' }: RenderTestRouterProps = {}) => {
|
|
23
|
-
const routes = [
|
|
24
|
-
{
|
|
25
|
-
path: '/:testId',
|
|
26
|
-
element: (
|
|
27
|
-
<div>
|
|
28
|
-
<h1>NavigateWithParams test</h1>
|
|
29
|
-
<Outlet />
|
|
30
|
-
</div>
|
|
31
|
-
),
|
|
32
|
-
children: [
|
|
33
|
-
{
|
|
34
|
-
index: true,
|
|
35
|
-
element: <NavigateWithParams to="/:testId/childRoute" replace />,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
path: '/:testId/childRoute',
|
|
39
|
-
element: (
|
|
40
|
-
<div>
|
|
41
|
-
<h2>NavigateWithParams child route</h2>
|
|
42
|
-
<LocationDisplay />
|
|
43
|
-
</div>
|
|
44
|
-
),
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
const router = createMemoryRouter(routes, { initialEntries: [url] });
|
|
51
|
-
|
|
52
|
-
return render(<RouterProvider router={router} />);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
20
|
describe('<NavigateWithParams />', () => {
|
|
56
21
|
it('should navigate with parent route params', async () => {
|
|
57
|
-
|
|
22
|
+
const routes = [
|
|
23
|
+
{
|
|
24
|
+
path: '/:testId',
|
|
25
|
+
element: (
|
|
26
|
+
<div>
|
|
27
|
+
<h1>NavigateWithParams test</h1>
|
|
28
|
+
<Outlet />
|
|
29
|
+
</div>
|
|
30
|
+
),
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
index: true,
|
|
34
|
+
element: <NavigateWithParams to="/:testId/childRoute" replace />,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
path: '/:testId/childRoute',
|
|
38
|
+
element: (
|
|
39
|
+
<div>
|
|
40
|
+
<h2>NavigateWithParams child route</h2>
|
|
41
|
+
<LocationDisplay />
|
|
42
|
+
</div>
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
render(<RouterWrapper routes={routes} initialEntries={['/myTestId']} />, { wrapper: null });
|
|
58
49
|
expect(await screen.findByRole('heading', { name: /NavigateWithParams test/ }));
|
|
59
50
|
expect(screen.getByRole('heading', { name: /NavigateWithParams child route/ }));
|
|
60
51
|
expect(screen.getByTestId('test-location-display')).toHaveTextContent('/myTestId/childRoute');
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
-
import { IntlProvider } from 'react-intl';
|
|
1
|
+
import { screen } from '@testing-library/react';
|
|
4
2
|
import { OrganizationFactory } from 'utils/test/factories/joanie';
|
|
3
|
+
import { render } from 'utils/test/render';
|
|
4
|
+
import { PresentationalAppWrapper } from 'utils/test/wrappers/PresentationalAppWrapper';
|
|
5
5
|
import OrganizationLinks from '.';
|
|
6
6
|
|
|
7
7
|
describe('OrganizationLinks', () => {
|
|
8
8
|
it('should render successfully organization with logo', () => {
|
|
9
9
|
const organization = OrganizationFactory({ title: 'Organization 1' }).one();
|
|
10
10
|
|
|
11
|
-
render(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<OrganizationLinks organizations={[organization]} />
|
|
15
|
-
</MemoryRouter>
|
|
16
|
-
</IntlProvider>,
|
|
17
|
-
);
|
|
11
|
+
render(<OrganizationLinks organizations={[organization]} />, {
|
|
12
|
+
wrapper: PresentationalAppWrapper,
|
|
13
|
+
});
|
|
18
14
|
|
|
19
15
|
// A link to the organization should be rendered
|
|
20
16
|
const link = screen.getByRole('link', { name: 'Organization 1' });
|
|
@@ -34,13 +30,9 @@ describe('OrganizationLinks', () => {
|
|
|
34
30
|
it('should render successfully organization with abbr', () => {
|
|
35
31
|
const organization = OrganizationFactory({ title: 'Organization 1', logo: null }).one();
|
|
36
32
|
|
|
37
|
-
render(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<OrganizationLinks organizations={[organization]} />
|
|
41
|
-
</MemoryRouter>
|
|
42
|
-
</IntlProvider>,
|
|
43
|
-
);
|
|
33
|
+
render(<OrganizationLinks organizations={[organization]} />, {
|
|
34
|
+
wrapper: PresentationalAppWrapper,
|
|
35
|
+
});
|
|
44
36
|
|
|
45
37
|
// A link to the organization should be rendered
|
|
46
38
|
const link = screen.getByRole('link', { name: 'Organization 1' });
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import fetchMock from 'fetch-mock';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { QueryClientProvider } from '@tanstack/react-query';
|
|
6
|
-
import { PropsWithChildren } from 'react';
|
|
7
|
-
import { CunninghamProvider } from '@openfun/cunningham-react';
|
|
8
|
-
import {
|
|
9
|
-
RichieContextFactory as mockRichieContextFactory,
|
|
10
|
-
UserFactory,
|
|
11
|
-
} from 'utils/test/factories/richie';
|
|
2
|
+
import { screen } from '@testing-library/react';
|
|
3
|
+
import { createIntl } from 'react-intl';
|
|
4
|
+
import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie';
|
|
12
5
|
import {
|
|
13
6
|
TEACHER_DASHBOARD_ROUTE_LABELS,
|
|
14
7
|
TeacherDashboardPaths,
|
|
15
8
|
} from 'widgets/Dashboard/utils/teacherRouteMessages';
|
|
16
|
-
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
17
|
-
import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider';
|
|
18
9
|
import { OrganizationFactory } from 'utils/test/factories/joanie';
|
|
19
10
|
import { messages as organizationLinksMessages } from 'widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks';
|
|
20
|
-
|
|
11
|
+
import { render } from 'utils/test/render';
|
|
12
|
+
import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
21
13
|
import { TeacherDashboardProfileSidebar } from '.';
|
|
22
14
|
|
|
23
15
|
jest.mock('utils/context', () => ({
|
|
@@ -37,39 +29,17 @@ jest.mock('utils/indirection/window', () => ({
|
|
|
37
29
|
const intl = createIntl({ locale: 'en' });
|
|
38
30
|
|
|
39
31
|
describe('<TeacherDashboardProfileSidebar/>', () => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
<QueryClientProvider client={createTestQueryClient({ user: UserFactory().one() })}>
|
|
43
|
-
<JoanieSessionProvider>
|
|
44
|
-
<MemoryRouter>
|
|
45
|
-
<CunninghamProvider>{children}</CunninghamProvider>
|
|
46
|
-
</MemoryRouter>
|
|
47
|
-
</JoanieSessionProvider>
|
|
48
|
-
</QueryClientProvider>
|
|
49
|
-
</IntlProvider>
|
|
50
|
-
);
|
|
32
|
+
const joanieSessionData = setupJoanieSession();
|
|
33
|
+
|
|
51
34
|
let nbApiRequest: number;
|
|
52
35
|
beforeEach(() => {
|
|
53
36
|
fetchMock.get('https://joanie.endpoint/api/v1.0/organizations/', []);
|
|
54
|
-
|
|
55
|
-
// JoanieSessionProvider inital requests
|
|
56
|
-
nbApiRequest = 3;
|
|
57
|
-
fetchMock.get('https://joanie.endpoint/api/v1.0/orders/', []);
|
|
58
|
-
fetchMock.get('https://joanie.endpoint/api/v1.0/addresses/', []);
|
|
59
|
-
fetchMock.get('https://joanie.endpoint/api/v1.0/credit-cards/', []);
|
|
60
|
-
});
|
|
61
|
-
afterEach(() => {
|
|
62
|
-
jest.clearAllMocks();
|
|
63
|
-
fetchMock.restore();
|
|
37
|
+
nbApiRequest = joanieSessionData.nbSessionApiRequest;
|
|
64
38
|
});
|
|
65
39
|
|
|
66
40
|
it('should display menu items', async () => {
|
|
67
41
|
nbApiRequest += 1; // call to organizations
|
|
68
|
-
render(
|
|
69
|
-
<Wrapper>
|
|
70
|
-
<TeacherDashboardProfileSidebar />
|
|
71
|
-
</Wrapper>,
|
|
72
|
-
);
|
|
42
|
+
render(<TeacherDashboardProfileSidebar />);
|
|
73
43
|
|
|
74
44
|
expect(
|
|
75
45
|
screen.getByRole('link', {
|
|
@@ -90,11 +60,7 @@ describe('<TeacherDashboardProfileSidebar/>', () => {
|
|
|
90
60
|
overwriteRoutes: true,
|
|
91
61
|
});
|
|
92
62
|
nbApiRequest += 1; // call to organizations
|
|
93
|
-
render(
|
|
94
|
-
<Wrapper>
|
|
95
|
-
<TeacherDashboardProfileSidebar />
|
|
96
|
-
</Wrapper>,
|
|
97
|
-
);
|
|
63
|
+
render(<TeacherDashboardProfileSidebar />);
|
|
98
64
|
expect(await screen.findByTestId('organization-links')).toBeInTheDocument();
|
|
99
65
|
expect(fetchMock.calls()).toHaveLength(nbApiRequest);
|
|
100
66
|
|
|
@@ -29,7 +29,7 @@ frontend/i18n/locales/pt-PT.json,sha256=01gz1z8D4gy_A-dunKXjbJed4liqTU_UF00YM5pF
|
|
|
29
29
|
frontend/i18n/locales/ru-RU.json,sha256=NH1g2engTLnzB5uTSf6eveesyfvKlSZl71MSDNRtggE,83844
|
|
30
30
|
frontend/i18n/locales/vi-VN.json,sha256=VpAQVbjtkDmPzK_-QwtIeY7UJh8b2N5smZSSRaNT9jQ,81205
|
|
31
31
|
frontend/jest/resolver.js,sha256=4z7-wQkCnESJaYqydt6N6YWXt9NMpU4XnmU4yjYEZ-E,1537
|
|
32
|
-
frontend/jest/setup.ts,sha256=
|
|
32
|
+
frontend/jest/setup.ts,sha256=HxjhHWrbEn8z1XDSSNhS6lgPYAf9N6IWbSZUPgmWRgI,1257
|
|
33
33
|
frontend/js/index.tsx,sha256=dGLR5CGfkrNUHoVeZaIpZSG3RiiZ-xeMHldid8_3pXY,5310
|
|
34
34
|
frontend/js/mockServiceWorker.js,sha256=BY7UoAMYNurVdR_7pjvJr28sweeSS1gnqKIpNSeYAQA,8196
|
|
35
35
|
frontend/js/settings.dev.dist.ts,sha256=ogD8HXCS-1GScZwc4tJA_QO9PR-45sIGFgrz8FYEgWk,112
|
|
@@ -423,6 +423,7 @@ frontend/js/utils/test/expectUrlMatchLocationDisplayed.ts,sha256=0Tx4oBG2tQ8a5_m
|
|
|
423
423
|
frontend/js/utils/test/isTestEnv.ts,sha256=FdSI-V2m9alzTN4iAN8nAw5zWP9OeQ-2pU2aVJAr9l4,77
|
|
424
424
|
frontend/js/utils/test/mockCourseProductWithOrder.ts,sha256=KPpkR8uxHivyGYP9JzDB-9TvAmimAszhYQUYPfuiVtk,813
|
|
425
425
|
frontend/js/utils/test/mockPaginatedResponse.ts,sha256=RN7QuIlvomI9fthxTrUikXX-ZI8nP0AaZOW5YzVFXOQ,367
|
|
426
|
+
frontend/js/utils/test/render.tsx,sha256=akp5aBuVi0xV8zjdbuz236s2zhSzesWotRWreCiNYyI,2591
|
|
426
427
|
frontend/js/utils/test/factories/factories.spec.ts,sha256=iSsPjYN7KlNAikl9s41-LCz5f4bq2v9wZ4ji-aeE-xU,4846
|
|
427
428
|
frontend/js/utils/test/factories/factories.ts,sha256=Cnsy8nymW-44jxOKTORykreaMACPCwBGxq9cHqrWc3I,2707
|
|
428
429
|
frontend/js/utils/test/factories/helper.spec.ts,sha256=vmq4eBedGzoUwuw-ZFQgaGtvf80b2DIhOgBg1t2K5YY,2368
|
|
@@ -431,6 +432,12 @@ frontend/js/utils/test/factories/joanie.spec.ts,sha256=SoLhAU1HVN6LJTbPcCGtV_zmU
|
|
|
431
432
|
frontend/js/utils/test/factories/joanie.ts,sha256=I0i0OcKnul8uYRUlrzrknjJ_jMoXkRdDcmUafoqdWQw,13411
|
|
432
433
|
frontend/js/utils/test/factories/reactQuery.ts,sha256=zo9qKB1LQeTZahdy5OZbLVC-__8PeqD2igODO5E3t2o,1546
|
|
433
434
|
frontend/js/utils/test/factories/richie.ts,sha256=nvQBVESdq2pLp82p3bvgB5AnFcvoLmX07pW_3k1dv2k,6872
|
|
435
|
+
frontend/js/utils/test/wrappers/IntlWrapper.tsx,sha256=PfwVv9cWwP7shG2PeEbSV34fU5d5g5CIGqi4at74SZM,677
|
|
436
|
+
frontend/js/utils/test/wrappers/JoanieAppWrapper.tsx,sha256=C2YB6dwYB4QlPhIHGy6eyWqpVhk_2CcJjB5ku3nJQjg,1457
|
|
437
|
+
frontend/js/utils/test/wrappers/PresentationalAppWrapper.tsx,sha256=ff9xYWKwX83zc2UkLGjdOHzUhE6QfbDb7hdJuMIKM5s,606
|
|
438
|
+
frontend/js/utils/test/wrappers/ReactQueryWrapper.tsx,sha256=KEijJe4v5ykq0mLFLY_SMW4a5UmYLpMU72pZE2NGbeg,542
|
|
439
|
+
frontend/js/utils/test/wrappers/RouterWrapper.tsx,sha256=6eOXiyiqpBAWlqbRt9lvKyWw6AeaOFWWTwb2Vm2wHoU,702
|
|
440
|
+
frontend/js/utils/test/wrappers/types.ts,sha256=SatBYwX7fJfweHllBpcX2YdIkpQ2t18AqcA4Gr8udNk,1070
|
|
434
441
|
frontend/js/widgets/index.spec.tsx,sha256=e_Hdz4mjMSEmNsa6K2nTuS7a9tSn8PPSYyf3PmWf0dw,4839
|
|
435
442
|
frontend/js/widgets/index.tsx,sha256=vmXFg5KQGjOyDXivpg3oLFnSmZo_TThbBCu731BOp80,4297
|
|
436
443
|
frontend/js/widgets/Dashboard/_styles.scss,sha256=WYer6DwHhhsDZvAP4e8EzR3j6gUwelVgHECU6JcpX0Q,91
|
|
@@ -508,7 +515,7 @@ frontend/js/widgets/Dashboard/components/FilterOrganization/index.tsx,sha256=Ny3
|
|
|
508
515
|
frontend/js/widgets/Dashboard/components/FiltersBar/index.tsx,sha256=XL5AL_mjUXRDLzXag8n3CstvPoGmFS6v6Jhy2z-nSeQ,250
|
|
509
516
|
frontend/js/widgets/Dashboard/components/LearnerDashboardSidebar/index.stories.tsx,sha256=xGOrjq7zlaA3kzUi05c5onUSvESycputfo5s6m7YbmI,802
|
|
510
517
|
frontend/js/widgets/Dashboard/components/LearnerDashboardSidebar/index.tsx,sha256=bS6jfzrY-irJ9YYDc3GdcR1WE01DfS3xazkZ1iuxKqs,1696
|
|
511
|
-
frontend/js/widgets/Dashboard/components/NavigateWithParams/index.spec.tsx,sha256=
|
|
518
|
+
frontend/js/widgets/Dashboard/components/NavigateWithParams/index.spec.tsx,sha256=UpCB5dJuyOo5evTMlS3BqlGkmCeoInEmTOAgt20yp3Y,1677
|
|
512
519
|
frontend/js/widgets/Dashboard/components/NavigateWithParams/index.tsx,sha256=VAaAeE82vtKgwgdb0Agq-abwq3jw79DsT7eBetzmDmA,399
|
|
513
520
|
frontend/js/widgets/Dashboard/components/ProtectedOutlet/AuthenticatedOutlet.spec.tsx,sha256=KZp8il4hp1Iwse_lKDYlrxjpMijYZ1wugxjXvTScyqo,3150
|
|
514
521
|
frontend/js/widgets/Dashboard/components/ProtectedOutlet/AuthenticatedOutlet.tsx,sha256=ihz08OV--yL_lkzjZ-bmAEEoCfFk9n9mUHWp8wsEQGI,539
|
|
@@ -528,11 +535,11 @@ frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/utils.ts,
|
|
|
528
535
|
frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx,sha256=nHvNOHi4zdbG4MbvRR8wMWdcxZvdGFwqmBRJnT0goek,5988
|
|
529
536
|
frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx,sha256=SNtqfdnY217R6zkSlljvI7QNYT6NUhaQkNOJjbCElAc,1622
|
|
530
537
|
frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.tsx,sha256=pQVFMGdLgsFBEY9tnCLIKXdMlJJOXVAu7mffAWWd0Ts,2809
|
|
531
|
-
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx,sha256=
|
|
538
|
+
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx,sha256=ZV0d_JCyr-twbFg2yoZYmBOzRsfwqRqtxasX4v-DbZU,3353
|
|
532
539
|
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.stories.tsx,sha256=mrb3Jm-8p5abdvQ3vr5OoeMGIhENmku8feOJxXT90AQ,851
|
|
533
540
|
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.tsx,sha256=wFT2euTVub7dknTkE-6b0AYGDSCD0lr2mcFExkYv024,1582
|
|
534
541
|
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/_styles.scss,sha256=rzJlbzXvrCO6kGrAgrqGThXnSE2NgcWuPW2Val8MFcI,1536
|
|
535
|
-
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx,sha256=
|
|
542
|
+
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx,sha256=w4p0x7L6qkvipjSAXTyflXDkVya7QjPVBQMeJMZxnn8,1963
|
|
536
543
|
frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.tsx,sha256=Fa6htqfin5xc1fPZFnkOweJp-ZRck1pYYsqa8wwEuak,2511
|
|
537
544
|
frontend/js/widgets/Dashboard/contexts/DashboardBreadcrumbsContext.tsx,sha256=xI6AwOM4bAoysj1-Qmo_11_q5Y2lOEQ8Qv9vP3SFGd8,1517
|
|
538
545
|
frontend/js/widgets/Dashboard/hooks/useDashboardRouter/getDashboardBasename.ts,sha256=46x5ut5dccVlIfitc8qsiX24FjZznwnDq5PnZrfYQ_k,271
|
|
@@ -2335,9 +2342,9 @@ richie/static/richie/js/build/9986.4f8226b1f37372f99368.index.js,sha256=YZTuD2Zq
|
|
|
2335
2342
|
richie/static/richie/js/build/99953.4f8226b1f37372f99368.index.js,sha256=OWoLPJnHrmvF3HBQPgXooAGo5E0yJpJ7QTFHFghJpI8,135
|
|
2336
2343
|
richie/static/richie/js/build/99962.4f8226b1f37372f99368.index.js,sha256=I84MIDhCYN2K4npCXyaDNnfTXb2xsBIzpZVnlTknM2s,8366
|
|
2337
2344
|
richie/static/richie/js/build/index.js,sha256=UVlwvREYQJJZdtYaef_euQTd0tGDIyK89eiSuwAaySU,1128515
|
|
2338
|
-
richie-2.25.0b2.
|
|
2339
|
-
richie-2.25.0b2.
|
|
2340
|
-
richie-2.25.0b2.
|
|
2341
|
-
richie-2.25.0b2.
|
|
2342
|
-
richie-2.25.0b2.
|
|
2343
|
-
richie-2.25.0b2.
|
|
2345
|
+
richie-2.25.0b2.dev101.dist-info/LICENSE,sha256=5LKjFIE1kpKzBfR2iwq_RGHhHM5XawdlfZrcHTsCLpA,1079
|
|
2346
|
+
richie-2.25.0b2.dev101.dist-info/METADATA,sha256=pfeC4kIvgEKH8wpeCIMvyiJuBCe0HGkwWb1HkE-ZXGs,6740
|
|
2347
|
+
richie-2.25.0b2.dev101.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
|
|
2348
|
+
richie-2.25.0b2.dev101.dist-info/top_level.txt,sha256=WJvFAAHtUQ5T5MOuG6jRynDJG9kVfl4jtuf1qxIXND8,16
|
|
2349
|
+
richie-2.25.0b2.dev101.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
2350
|
+
richie-2.25.0b2.dev101.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|