mirror of
https://github.com/strapi/strapi.git
synced 2025-08-23 08:09:10 +00:00
test: please work units
This commit is contained in:
parent
9ecb47b3f9
commit
00f1e17248
@ -113,6 +113,8 @@ describe('WorkflowAttributes', () => {
|
||||
|
||||
const { getByRole, queryByRole, user } = setup();
|
||||
|
||||
await screen.findByText(/workflow name/i);
|
||||
|
||||
const contentTypesSelect = getByRole('combobox', { name: /associated to/i });
|
||||
|
||||
await user.click(contentTypesSelect);
|
||||
|
@ -30,7 +30,7 @@ import styled from 'styled-components';
|
||||
|
||||
import { PERMISSIONS } from '../constants';
|
||||
import {
|
||||
useGetInfosQuery,
|
||||
useGetInfoQuery,
|
||||
useRegenerateDocMutation,
|
||||
useDeleteVersionMutation,
|
||||
} from '../services/api';
|
||||
@ -40,7 +40,7 @@ const App = () => {
|
||||
const { formatMessage } = useIntl();
|
||||
const { toggleNotification } = useNotification();
|
||||
const { formatAPIError } = useAPIErrorHandler();
|
||||
const { data, isLoading: isLoadingInfo, isError } = useGetInfosQuery();
|
||||
const { data, isLoading: isLoadingInfo, isError } = useGetInfoQuery();
|
||||
const [regenerate] = useRegenerateDocMutation();
|
||||
const [deleteVersion] = useDeleteVersionMutation();
|
||||
const [showConfirmDelete, setShowConfirmDelete] = React.useState<boolean>(false);
|
||||
|
@ -6,7 +6,7 @@ import { FormikHelpers } from 'formik';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
import { SettingsForm } from '../components/SettingsForm';
|
||||
import { useGetInfosQuery, useUpdateSettingsMutation } from '../services/api';
|
||||
import { useGetInfoQuery, useUpdateSettingsMutation } from '../services/api';
|
||||
import { getTrad, isBaseQueryError } from '../utils';
|
||||
|
||||
import type { SettingsInput } from '../types';
|
||||
@ -18,7 +18,7 @@ const SettingsPage = () => {
|
||||
_unstableFormatAPIError: formatAPIError,
|
||||
_unstableFormatValidationErrors: formatValidationErrors,
|
||||
} = useAPIErrorHandler();
|
||||
const { data, isError, isLoading } = useGetInfosQuery();
|
||||
const { data, isError, isLoading, isFetching } = useGetInfoQuery();
|
||||
const [updateSettings] = useUpdateSettingsMutation();
|
||||
|
||||
const onUpdateSettings = async (body: SettingsInput, formik: FormikHelpers<SettingsInput>) => {
|
||||
@ -45,7 +45,7 @@ const SettingsPage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
if (isLoading || isFetching) {
|
||||
return <Page.Loading />;
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,10 @@ describe('SettingsPage', () => {
|
||||
|
||||
fireEvent.click(getByRole('button', { name: 'Save' }));
|
||||
|
||||
await findByText('Loading content.');
|
||||
|
||||
await findByText('Successfully updated settings');
|
||||
|
||||
await waitFor(() => expect(queryByText('Loading content.')).not.toBeInTheDocument());
|
||||
});
|
||||
});
|
||||
|
@ -11,12 +11,12 @@ type SettingsInput = {
|
||||
const api = createApi({
|
||||
reducerPath: 'plugin::documentation',
|
||||
baseQuery: baseQuery(),
|
||||
tagTypes: ['DocumentInfos'],
|
||||
tagTypes: ['DocumentInfo'],
|
||||
endpoints: (builder) => {
|
||||
return {
|
||||
getInfos: builder.query<DocumentInfos, void>({
|
||||
getInfo: builder.query<DocumentInfos, void>({
|
||||
query: () => '/documentation/getInfos',
|
||||
providesTags: ['DocumentInfos'],
|
||||
providesTags: ['DocumentInfo'],
|
||||
}),
|
||||
|
||||
deleteVersion: builder.mutation<void, { version: string }>({
|
||||
@ -24,7 +24,7 @@ const api = createApi({
|
||||
url: `/documentation/deleteDoc/${version}`,
|
||||
method: 'DELETE',
|
||||
}),
|
||||
invalidatesTags: ['DocumentInfos'],
|
||||
invalidatesTags: ['DocumentInfo'],
|
||||
}),
|
||||
|
||||
updateSettings: builder.mutation<void, { body: SettingsInput }>({
|
||||
@ -33,7 +33,7 @@ const api = createApi({
|
||||
method: 'PUT',
|
||||
data: body,
|
||||
}),
|
||||
invalidatesTags: ['DocumentInfos'],
|
||||
invalidatesTags: ['DocumentInfo'],
|
||||
}),
|
||||
|
||||
regenerateDoc: builder.mutation<void, { version: string }>({
|
||||
@ -50,7 +50,7 @@ const api = createApi({
|
||||
export { api };
|
||||
|
||||
export const {
|
||||
useGetInfosQuery,
|
||||
useGetInfoQuery,
|
||||
useDeleteVersionMutation,
|
||||
useUpdateSettingsMutation,
|
||||
useRegenerateDocMutation,
|
||||
|
@ -127,6 +127,11 @@ describe('Roles – EditPage', () => {
|
||||
fireEvent.click(getByRole('button', { name: 'Save' }));
|
||||
|
||||
await waitFor(() => expect(getByText('Role edited')).toBeInTheDocument());
|
||||
|
||||
/**
|
||||
* @note the permissions are refetched, because we're mocking calls no real update will be made.
|
||||
*/
|
||||
await waitFor(() => expect(getByRole('checkbox', { name: 'create' })).not.toBeChecked());
|
||||
});
|
||||
|
||||
it('will update the Advanced Settings panel when you click on the cog icon of a specific permission', async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user