diff --git a/src/pages/categories/Edit.spec.tsx b/src/pages/categories/Edit.spec.tsx new file mode 100644 index 00000000..5641ba06 --- /dev/null +++ b/src/pages/categories/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Category') + +describe('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..a565557d --- /dev/null +++ b/src/pages/categories/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Category') + +describe('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..1b948584 --- /dev/null +++ b/src/pages/categories/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Category') + +describe('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..1174fc74 --- /dev/null +++ b/src/pages/categoryCombos/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Category combo') + +describe('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..212105cb --- /dev/null +++ b/src/pages/categoryCombos/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Category combo') + +describe('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..53d3ca6f --- /dev/null +++ b/src/pages/categoryCombos/New.spec.tsx @@ -0,0 +1,14 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Category combo') + +describe('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..2acbae34 --- /dev/null +++ b/src/pages/categoryOptionCombos/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Category option combo') + +describe('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..ea395123 --- /dev/null +++ b/src/pages/categoryOptionCombos/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Category option combo') + +describe('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..d5ac9c5d --- /dev/null +++ b/src/pages/categoryOptionGroupSets/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Category option group set') + +describe('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..3a19fed8 --- /dev/null +++ b/src/pages/categoryOptionGroupSets/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Category option group set') + +describe('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..e8217a87 --- /dev/null +++ b/src/pages/categoryOptionGroupSets/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Category option group set') + +describe('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..ca953fb1 --- /dev/null +++ b/src/pages/categoryOptionGroups/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Category option group') + +describe('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..83277c15 --- /dev/null +++ b/src/pages/categoryOptionGroups/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Category option group') + +describe('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..c2607d92 --- /dev/null +++ b/src/pages/categoryOptionGroups/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Category option group') + +describe('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..09948a0f --- /dev/null +++ b/src/pages/categoryOptions/Edit.spec.tsx @@ -0,0 +1,11 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Category option') + +describe('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..54c5ec8e --- /dev/null +++ b/src/pages/categoryOptions/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Category option') + +describe('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..c30d495e --- /dev/null +++ b/src/pages/categoryOptions/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Category option') + +describe('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..6df9a11e --- /dev/null +++ b/src/pages/dataElementGroupSets/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Data element group set') + +describe('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..b19c792e --- /dev/null +++ b/src/pages/dataElementGroupSets/List.spec.tsx @@ -0,0 +1,3 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('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..bafff732 --- /dev/null +++ b/src/pages/dataElementGroupSets/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Data element group set') + +describe('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..ba01f67b --- /dev/null +++ b/src/pages/dataElementGroups/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Data element group') + +describe('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..5626fd4a --- /dev/null +++ b/src/pages/dataElementGroups/List.spec.tsx @@ -0,0 +1,3 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('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..e20ecec7 --- /dev/null +++ b/src/pages/dataElementGroups/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Data element group') + +describe('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..6ddd9b74 --- /dev/null +++ b/src/pages/dataElements/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Data element') + +describe('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..08578ab1 100644 --- a/src/pages/dataElements/List.spec.tsx +++ b/src/pages/dataElements/List.spec.tsx @@ -19,6 +19,7 @@ import TestComponentWithRouter, { import dataElementsMock from './__mocks__/list/dataElementsMock.json' import filteredDataElementsMock from './__mocks__/list/filteredDataElementsMock.json' import { Component as DataElementList } from './List' +import { generateDefaultListTests } from '../defaultListTests' const FIRST_DATA_ELEMENT = dataElementsMock.dataElements[0] const FIRST_FILTERED_DATA_ELEMENT = filteredDataElementsMock.dataElements[0] @@ -52,7 +53,9 @@ const error404 = new FetchError({ }) const defaultUserDataStoreData = () => Promise.reject(new FetchError(error404)) -describe('Data Elements List', () => { +generateDefaultListTests('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..8c51f8dd 100644 --- a/src/pages/dataElements/New.spec.tsx +++ b/src/pages/dataElements/New.spec.tsx @@ -8,6 +8,7 @@ import { ComponentWithProvider } from '../../testUtils/TestComponentWithRouter' import attributes from './__mocks__/attributes.json' import categoryCombosPage1 from './__mocks__/categoryCombosPage1.json' import { Component as New } from './New' +import { generateDefaultAddFormTests } from '../defaultFormTests' jest.mock('../../lib/routeUtils/useSectionHandle', () => ({ useSchemaSectionHandleOrThrow: jest.fn(() => ({ @@ -56,6 +57,8 @@ async function changeSingleSelect( fireEvent.click(optionElement) } +generateDefaultAddFormTests('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..692bf353 --- /dev/null +++ b/src/pages/dataSets/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Data sets') + +describe('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..3a11878a --- /dev/null +++ b/src/pages/defaultFormTests.tsx @@ -0,0 +1,13 @@ +export const generateDefaultAddFormTests = ({ componentName }) => { + describe(`${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 }) => { + describe(`${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..88de3c76 --- /dev/null +++ b/src/pages/defaultListTests.tsx @@ -0,0 +1,43 @@ +export const generateDefaultListTests = ({ componentName }) => { + describe(`${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', () => {}) + }) + + describe(`${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', () => {}) + }) + + describe(`${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', () => {}) + }) + + describe(`${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..0aa368dd --- /dev/null +++ b/src/pages/indicatorTypes/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('Indicator type') + +describe('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..ab0aae96 --- /dev/null +++ b/src/pages/indicatorTypes/List.spec.tsx @@ -0,0 +1,3 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Indicator type') diff --git a/src/pages/indicatorTypes/New.spec.tsx b/src/pages/indicatorTypes/New.spec.tsx new file mode 100644 index 00000000..fd62fc1e --- /dev/null +++ b/src/pages/indicatorTypes/New.spec.tsx @@ -0,0 +1,13 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('Indicator type') + +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 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..00be7566 --- /dev/null +++ b/src/pages/indicators/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests('Indicators') + +describe('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..3eaba280 --- /dev/null +++ b/src/pages/organisationUnits/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests('organisation unit') + +describe('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..b33fbe4d --- /dev/null +++ b/src/pages/organisationUnits/New.spec.tsx @@ -0,0 +1,31 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests('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', () => {}) +})