diff --git a/src/pages/categories/Edit.spec.tsx b/src/pages/categories/Edit.spec.tsx new file mode 100644 index 00000000..1987ffb6 --- /dev/null +++ b/src/pages/categories/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Category' }) + +xdescribe('Category edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/categories/List.spec.tsx b/src/pages/categories/List.spec.tsx new file mode 100644 index 00000000..a92a5c35 --- /dev/null +++ b/src/pages/categories/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Category' }) + +xdescribe('Category additional tests', () => { + it('should filter by data dimension type', () => {}) + it('should filter by data category combo', () => {}) +}) diff --git a/src/pages/categories/New.spec.tsx b/src/pages/categories/New.spec.tsx new file mode 100644 index 00000000..0fb1dedb --- /dev/null +++ b/src/pages/categories/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Category' }) + +xdescribe('Category add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) + it('not show an add all button for category options', () => {}) +}) diff --git a/src/pages/categoryCombos/Edit.spec.tsx b/src/pages/categoryCombos/Edit.spec.tsx new file mode 100644 index 00000000..17dc9003 --- /dev/null +++ b/src/pages/categoryCombos/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Category combo' }) + +xdescribe('Category combo edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/categoryCombos/List.spec.tsx b/src/pages/categoryCombos/List.spec.tsx new file mode 100644 index 00000000..d618e1c8 --- /dev/null +++ b/src/pages/categoryCombos/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Category combo' }) + +xdescribe('Category combos additional tests', () => { + it('should filter by data dimension type', () => {}) + it('should filter by data category combo', () => {}) +}) diff --git a/src/pages/categoryCombos/New.spec.tsx b/src/pages/categoryCombos/New.spec.tsx new file mode 100644 index 00000000..e4c10aaa --- /dev/null +++ b/src/pages/categoryCombos/New.spec.tsx @@ -0,0 +1,14 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Category combo' }) + +xdescribe('Category combo add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) + it('not show an add all button for categories', () => {}) +}) diff --git a/src/pages/categoryOptionCombos/Edit.spec.tsx b/src/pages/categoryOptionCombos/Edit.spec.tsx new file mode 100644 index 00000000..07647a95 --- /dev/null +++ b/src/pages/categoryOptionCombos/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Category option combo' }) + +xdescribe('Category option combo edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not be able to edit name', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/categoryOptionCombos/List.spec.tsx b/src/pages/categoryOptionCombos/List.spec.tsx new file mode 100644 index 00000000..bc727c51 --- /dev/null +++ b/src/pages/categoryOptionCombos/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Category option combo' }) + +xdescribe('Category option combo additional tests', () => { + it('should filter by category option', () => {}) + it('should filter by category combo', () => {}) +}) diff --git a/src/pages/categoryOptionGroupSets/Edit.spec.tsx b/src/pages/categoryOptionGroupSets/Edit.spec.tsx new file mode 100644 index 00000000..478a0d9e --- /dev/null +++ b/src/pages/categoryOptionGroupSets/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Category option group set' }) + +xdescribe('Category option group set edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/categoryOptionGroupSets/List.spec.tsx b/src/pages/categoryOptionGroupSets/List.spec.tsx new file mode 100644 index 00000000..272138f4 --- /dev/null +++ b/src/pages/categoryOptionGroupSets/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Category option group set' }) + +xdescribe('Category option group set additional tests', () => { + it('should filter by data dimension type', () => {}) +}) diff --git a/src/pages/categoryOptionGroupSets/New.spec.tsx b/src/pages/categoryOptionGroupSets/New.spec.tsx new file mode 100644 index 00000000..e69da347 --- /dev/null +++ b/src/pages/categoryOptionGroupSets/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Category option group set' }) + +xdescribe('Category option group set add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) + it('not show an add all button for category option groups', () => {}) +}) diff --git a/src/pages/categoryOptionGroups/Edit.spec.tsx b/src/pages/categoryOptionGroups/Edit.spec.tsx new file mode 100644 index 00000000..518d2f59 --- /dev/null +++ b/src/pages/categoryOptionGroups/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Category option group' }) + +xdescribe('Category option group edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/categoryOptionGroups/List.spec.tsx b/src/pages/categoryOptionGroups/List.spec.tsx new file mode 100644 index 00000000..7e9d2b62 --- /dev/null +++ b/src/pages/categoryOptionGroups/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Category option group' }) + +xdescribe('Category option group additional tests', () => { + it('should filter by data dimension type', () => {}) +}) diff --git a/src/pages/categoryOptionGroups/New.spec.tsx b/src/pages/categoryOptionGroups/New.spec.tsx new file mode 100644 index 00000000..7c292031 --- /dev/null +++ b/src/pages/categoryOptionGroups/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Category option group' }) + +xdescribe('Category option group add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) + it('not show an add all button for category options', () => {}) +}) diff --git a/src/pages/categoryOptions/Edit.spec.tsx b/src/pages/categoryOptions/Edit.spec.tsx new file mode 100644 index 00000000..945514de --- /dev/null +++ b/src/pages/categoryOptions/Edit.spec.tsx @@ -0,0 +1,11 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Category option' }) + +xdescribe('Category option edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('display dates in the required format', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/categoryOptions/List.spec.tsx b/src/pages/categoryOptions/List.spec.tsx new file mode 100644 index 00000000..5fba9656 --- /dev/null +++ b/src/pages/categoryOptions/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Category option' }) + +xdescribe('Category option additional tests', () => { + it('should filter by category', () => {}) + it('should filter by category option group', () => {}) +}) diff --git a/src/pages/categoryOptions/New.spec.tsx b/src/pages/categoryOptions/New.spec.tsx new file mode 100644 index 00000000..ca5f88cb --- /dev/null +++ b/src/pages/categoryOptions/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Category option' }) + +xdescribe('Category option add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) + it('not show an add all button for category option groups', () => {}) +}) diff --git a/src/pages/dataElementGroupSets/Edit.spec.tsx b/src/pages/dataElementGroupSets/Edit.spec.tsx new file mode 100644 index 00000000..9134ff39 --- /dev/null +++ b/src/pages/dataElementGroupSets/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Data element group set' }) + +xdescribe('Data element group set edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/dataElementGroupSets/List.spec.tsx b/src/pages/dataElementGroupSets/List.spec.tsx new file mode 100644 index 00000000..a8df2652 --- /dev/null +++ b/src/pages/dataElementGroupSets/List.spec.tsx @@ -0,0 +1,3 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Data element group set' }) diff --git a/src/pages/dataElementGroupSets/New.spec.tsx b/src/pages/dataElementGroupSets/New.spec.tsx new file mode 100644 index 00000000..f724cfb9 --- /dev/null +++ b/src/pages/dataElementGroupSets/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Data element group set' }) + +xdescribe('Data element group set add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) +}) diff --git a/src/pages/dataElementGroups/Edit.spec.tsx b/src/pages/dataElementGroups/Edit.spec.tsx new file mode 100644 index 00000000..0bc6e3a5 --- /dev/null +++ b/src/pages/dataElementGroups/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Data element group' }) + +xdescribe('Data element group edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/dataElementGroups/List.spec.tsx b/src/pages/dataElementGroups/List.spec.tsx new file mode 100644 index 00000000..455c226b --- /dev/null +++ b/src/pages/dataElementGroups/List.spec.tsx @@ -0,0 +1,3 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Data element group' }) diff --git a/src/pages/dataElementGroups/New.spec.tsx b/src/pages/dataElementGroups/New.spec.tsx new file mode 100644 index 00000000..56f198c6 --- /dev/null +++ b/src/pages/dataElementGroups/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Data element group' }) + +xdescribe('Data element group add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) +}) diff --git a/src/pages/dataElements/Edit.spec.tsx b/src/pages/dataElements/Edit.spec.tsx new file mode 100644 index 00000000..703275ed --- /dev/null +++ b/src/pages/dataElements/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Data element' }) + +xdescribe('Data element edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/dataElements/List.spec.tsx b/src/pages/dataElements/List.spec.tsx index 22a18298..cb5fcaea 100644 --- a/src/pages/dataElements/List.spec.tsx +++ b/src/pages/dataElements/List.spec.tsx @@ -16,6 +16,7 @@ import { useCurrentUserStore } from '../../lib/user/currentUserStore' import TestComponentWithRouter, { CustomData, } from '../../testUtils/TestComponentWithRouter' +import { generateDefaultListTests } from '../defaultListTests' import dataElementsMock from './__mocks__/list/dataElementsMock.json' import filteredDataElementsMock from './__mocks__/list/filteredDataElementsMock.json' import { Component as DataElementList } from './List' @@ -52,7 +53,9 @@ const error404 = new FetchError({ }) const defaultUserDataStoreData = () => Promise.reject(new FetchError(error404)) -describe('Data Elements List', () => { +generateDefaultListTests({ componentName: 'Data element' }) + +describe('Data Element List additional tests', () => { const originalWarn = console.warn jest.spyOn(console, 'warn').mockImplementation((value) => { if (!value.match(/No server timezone/)) { diff --git a/src/pages/dataElements/New.spec.tsx b/src/pages/dataElements/New.spec.tsx index 1ed46e58..4fc30df7 100644 --- a/src/pages/dataElements/New.spec.tsx +++ b/src/pages/dataElements/New.spec.tsx @@ -5,6 +5,7 @@ import dataElementSchemaMock from '../../__mocks__/schema/dataElementsSchema.jso import { useSchemaStore } from '../../lib/schemas/schemaStore' import { ModelSchemas } from '../../lib/useLoadApp' import { ComponentWithProvider } from '../../testUtils/TestComponentWithRouter' +import { generateDefaultAddFormTests } from '../defaultFormTests' import attributes from './__mocks__/attributes.json' import categoryCombosPage1 from './__mocks__/categoryCombosPage1.json' import { Component as New } from './New' @@ -56,6 +57,8 @@ async function changeSingleSelect( fireEvent.click(optionElement) } +generateDefaultAddFormTests({ componentName: 'Data element group set' }) + describe('Data Elements / New', () => { const consoleWarn = console.warn jest.spyOn(console, 'warn').mockImplementation((value) => { @@ -192,4 +195,13 @@ describe('Data Elements / New', () => { const listView = await result.findByText('List view') expect(listView).toBeTruthy() }) + + it('contain all needed field', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short name field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) }) diff --git a/src/pages/dataSets/List.spec.tsx b/src/pages/dataSets/List.spec.tsx new file mode 100644 index 00000000..64a3208e --- /dev/null +++ b/src/pages/dataSets/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Data sets' }) + +xdescribe('Data sets additional tests', () => { + it('should filter by form type', () => {}) +}) diff --git a/src/pages/defaultFormTests.tsx b/src/pages/defaultFormTests.tsx new file mode 100644 index 00000000..0f40106a --- /dev/null +++ b/src/pages/defaultFormTests.tsx @@ -0,0 +1,21 @@ +export const generateDefaultAddFormTests = ({ + componentName, +}: { + componentName: string +}) => { + xdescribe(`${componentName} default add form tests`, () => { + it('should should return to the list view when cancelling', () => {}) + it('should show a loader while the form is being submitted ', () => {}) + }) +} + +export const generateDefaultEditFormTests = ({ + componentName, +}: { + componentName: string +}) => { + xdescribe(`${componentName} default add form tests`, () => { + it('should should return to the list view when cancelling', () => {}) + it('should show a loader while the form is being submitted ', () => {}) + }) +} diff --git a/src/pages/defaultListTests.tsx b/src/pages/defaultListTests.tsx new file mode 100644 index 00000000..3309480f --- /dev/null +++ b/src/pages/defaultListTests.tsx @@ -0,0 +1,47 @@ +export const generateDefaultListTests = ({ + componentName, +}: { + componentName: string +}) => { + xdescribe(`${componentName} default list tests`, () => { + it('should display all the items in the first page', () => {}) + it('should display the default columns', () => {}) + it('can change the visible columns through manage view', () => {}) + it('should change the number of items that are displayed in a page when the number of items per page is changed', () => {}) + it('can navigate through pages and show the corresponding items', () => {}) + it('can sort teh results by columns', () => {}) + it('should display error when an API call fails', () => {}) + }) + + xdescribe(`${componentName} default filter tests`, () => { + it('scan filter the results by code using the input field', () => {}) + it('scan filter the results by name using the input field', () => {}) + it('scan filter the results by id using the input field', () => {}) + it('should display the default filters', () => {}) + it('can change the visible filters through manage view', () => {}) + it('can remove all filters through manage view', () => {}) + }) + + xdescribe(`${componentName} default row actions tests`, () => { + it('should display teh default actions in the actions menu', () => {}) + it('redirect to the edit page when clicking on the edit action', () => {}) + it('redirect to the edit page when clicking on the pencil icon', () => {}) + it('delete an item when pressing teh delete action and confirming', () => {}) + it('update the list when an item is deleted', () => {}) + it('show the detail panel when the show details action is clicked', () => {}) + it('show an edit button in the details panel', () => {}) + it('be able to copy the api url in the details panel', () => {}) + it('should open the sharing settings dialog when the sharing settings action is clicked', () => {}) + it('should update the list view when the sharing settings dialog is closed', () => {}) + it('should open a translation dialog when teh translate action is clicked', () => {}) + it('should successfully save a new translation', () => {}) + }) + + xdescribe(`${componentName} default multiple actions tests`, () => { + it('should display the multiple actions banner when 1 or more items are selected', () => {}) + it('should indicate how many items were selected', () => {}) + it('should update sharing settings for multiple items', () => {}) + it('should download multiple items', () => {}) + it('deselect all selected items', () => {}) + }) +} diff --git a/src/pages/indicatorTypes/Edit.spec.tsx b/src/pages/indicatorTypes/Edit.spec.tsx new file mode 100644 index 00000000..b6e65f14 --- /dev/null +++ b/src/pages/indicatorTypes/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'Indicator type' }) + +xdescribe('Indicator type edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/indicatorTypes/List.spec.tsx b/src/pages/indicatorTypes/List.spec.tsx new file mode 100644 index 00000000..9750d085 --- /dev/null +++ b/src/pages/indicatorTypes/List.spec.tsx @@ -0,0 +1,3 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Indicator type' }) diff --git a/src/pages/indicatorTypes/New.spec.tsx b/src/pages/indicatorTypes/New.spec.tsx new file mode 100644 index 00000000..068eebff --- /dev/null +++ b/src/pages/indicatorTypes/New.spec.tsx @@ -0,0 +1,13 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Indicator type' }) + +xdescribe('Indicator type add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if factor field is too large', () => {}) + it('should show an error if factor field is too small', () => {}) + it('allow factor field to be 0', () => {}) +}) diff --git a/src/pages/indicators/List.spec.tsx b/src/pages/indicators/List.spec.tsx new file mode 100644 index 00000000..77dcefa8 --- /dev/null +++ b/src/pages/indicators/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: 'Indicators' }) + +xdescribe('Data sets additional tests', () => { + it('should filter by indicator type', () => {}) +}) diff --git a/src/pages/organisationUnits/Edit.spec.tsx b/src/pages/organisationUnits/Edit.spec.tsx new file mode 100644 index 00000000..5f357931 --- /dev/null +++ b/src/pages/organisationUnits/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: 'organisation unit' }) + +xdescribe('Indicator type edit form additional tests', () => { + it('contain all needed field prefilled', () => {}) + it('should not submit when a required values is removed ', () => {}) + it('should submit the data and return to the list view on success when a field is changed', () => {}) + it('should do nothing and return to the list view on success when no field is changed', () => {}) +}) diff --git a/src/pages/organisationUnits/List.spec.tsx b/src/pages/organisationUnits/List.spec.tsx index 3581086b..27403f8f 100644 --- a/src/pages/organisationUnits/List.spec.tsx +++ b/src/pages/organisationUnits/List.spec.tsx @@ -91,7 +91,7 @@ const renderList = async ({ return result } -describe('Org Unit List', () => { +describe('Organisation unit list', () => { const originalWarn = console.warn jest.spyOn(console, 'warn').mockImplementation((value) => { if (!value.match(/No server timezone/)) { diff --git a/src/pages/organisationUnits/New.spec.tsx b/src/pages/organisationUnits/New.spec.tsx new file mode 100644 index 00000000..08135911 --- /dev/null +++ b/src/pages/organisationUnits/New.spec.tsx @@ -0,0 +1,31 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: 'Organisation unit' }) + +describe('Indicator type add form additional tests', () => { + it('contain all needed field', () => {}) + it('should not submit when required values are missing', () => {}) + it('should submit the data and return to the list view on success', () => {}) + it('should show an error if name field is too long', () => {}) + it('should show an error if short field is too long', () => {}) + it('should show an error if code field is too long', () => {}) + it('should show an error if comment field is too long', () => {}) + it('should show an error if description field is too long', () => {}) + it('should show an error if contact person field is too long', () => {}) + it('should show an error if address field is too long', () => {}) + it('should show an error if phone number field is too long', () => {}) + it('should show an error if url field is too long', () => {}) + it('should show an error if name field is a duplicate', () => {}) + it('should show an error if short name field is a duplicate', () => {}) + it('should show an error if code field is a duplicate', () => {}) + it('should show an error if opening date is not in required format', () => {}) + it('should show an error if closing date is not in required format', () => {}) + it('should show an error if image was not uploaded correctly', () => {}) + it('should allow to create an org unit as a child of the root org unit', () => {}) + it('should show an error if entering an invalid URL', () => {}) + it('should show an error if longitude is above 90', () => {}) + it('should show an error if longitude is below -90', () => {}) + it('should show an error if latitude is above 180', () => {}) + it('should show an error if latitude is below -180', () => {}) + it('should show an error if email is not valid', () => {}) +})