diff --git a/src/pages/categories/Edit.spec.tsx b/src/pages/categories/Edit.spec.tsx new file mode 100644 index 00000000..658e0a1a --- /dev/null +++ b/src/pages/categories/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..fc48c416 --- /dev/null +++ b/src/pages/categories/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..72f5be3c --- /dev/null +++ b/src/pages/categories/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..2fe2f4b6 --- /dev/null +++ b/src/pages/categoryCombos/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..d7026245 --- /dev/null +++ b/src/pages/categoryCombos/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..b0b20983 --- /dev/null +++ b/src/pages/categoryCombos/New.spec.tsx @@ -0,0 +1,14 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..642cdfae --- /dev/null +++ b/src/pages/categoryOptionCombos/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..dcea04e1 --- /dev/null +++ b/src/pages/categoryOptionCombos/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..90e343a7 --- /dev/null +++ b/src/pages/categoryOptionGroupSets/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..00e2216a --- /dev/null +++ b/src/pages/categoryOptionGroupSets/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..c6f6342a --- /dev/null +++ b/src/pages/categoryOptionGroupSets/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..79db6bc7 --- /dev/null +++ b/src/pages/categoryOptionGroups/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..b6ea2134 --- /dev/null +++ b/src/pages/categoryOptionGroups/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..19d791f8 --- /dev/null +++ b/src/pages/categoryOptionGroups/New.spec.tsx @@ -0,0 +1,17 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..07eb4412 --- /dev/null +++ b/src/pages/categoryOptions/Edit.spec.tsx @@ -0,0 +1,11 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..1885b6e9 --- /dev/null +++ b/src/pages/categoryOptions/List.spec.tsx @@ -0,0 +1,8 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..03ac180a --- /dev/null +++ b/src/pages/categoryOptions/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..56f599a9 --- /dev/null +++ b/src/pages/dataElementGroupSets/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..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..83333216 --- /dev/null +++ b/src/pages/dataElementGroupSets/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..9783b021 --- /dev/null +++ b/src/pages/dataElementGroups/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..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..49cb929f --- /dev/null +++ b/src/pages/dataElementGroups/New.spec.tsx @@ -0,0 +1,16 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..1a1721da --- /dev/null +++ b/src/pages/dataElements/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..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..ce1a60e3 --- /dev/null +++ b/src/pages/dataSets/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..fa9b2694 --- /dev/null +++ b/src/pages/defaultFormTests.tsx @@ -0,0 +1,21 @@ +export const generateDefaultAddFormTests = ({ + componentName, +}: { + componentName: string +}) => { + 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, +}: { + componentName: string +}) => { + 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..af72a112 --- /dev/null +++ b/src/pages/defaultListTests.tsx @@ -0,0 +1,47 @@ +export const generateDefaultListTests = ({ + componentName, +}: { + componentName: string +}) => { + 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..8abc37b1 --- /dev/null +++ b/src/pages/indicatorTypes/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..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..7fab4261 --- /dev/null +++ b/src/pages/indicatorTypes/New.spec.tsx @@ -0,0 +1,13 @@ +import { generateDefaultAddFormTests } from '../defaultFormTests' + +generateDefaultAddFormTests({ componentName: '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..25a1c34e --- /dev/null +++ b/src/pages/indicators/List.spec.tsx @@ -0,0 +1,7 @@ +import { generateDefaultListTests } from '../defaultListTests' + +generateDefaultListTests({ componentName: '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..4bf51d7b --- /dev/null +++ b/src/pages/organisationUnits/Edit.spec.tsx @@ -0,0 +1,10 @@ +import { generateDefaultEditFormTests } from '../defaultFormTests' + +generateDefaultEditFormTests({ componentName: '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..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', () => {}) +})