Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add initial list of test specs #464

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/pages/categories/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
8 changes: 8 additions & 0 deletions src/pages/categories/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
17 changes: 17 additions & 0 deletions src/pages/categories/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/categoryCombos/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
8 changes: 8 additions & 0 deletions src/pages/categoryCombos/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
14 changes: 14 additions & 0 deletions src/pages/categoryCombos/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/categoryOptionCombos/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
8 changes: 8 additions & 0 deletions src/pages/categoryOptionCombos/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/categoryOptionGroupSets/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
7 changes: 7 additions & 0 deletions src/pages/categoryOptionGroupSets/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
17 changes: 17 additions & 0 deletions src/pages/categoryOptionGroupSets/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/categoryOptionGroups/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
7 changes: 7 additions & 0 deletions src/pages/categoryOptionGroups/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
17 changes: 17 additions & 0 deletions src/pages/categoryOptionGroups/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
11 changes: 11 additions & 0 deletions src/pages/categoryOptions/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
8 changes: 8 additions & 0 deletions src/pages/categoryOptions/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
16 changes: 16 additions & 0 deletions src/pages/categoryOptions/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/dataElementGroupSets/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
3 changes: 3 additions & 0 deletions src/pages/dataElementGroupSets/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { generateDefaultListTests } from '../defaultListTests'

generateDefaultListTests({ componentName: 'Data element group set' })
16 changes: 16 additions & 0 deletions src/pages/dataElementGroupSets/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/dataElementGroups/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
3 changes: 3 additions & 0 deletions src/pages/dataElementGroups/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { generateDefaultListTests } from '../defaultListTests'

generateDefaultListTests({ componentName: 'Data element group' })
16 changes: 16 additions & 0 deletions src/pages/dataElementGroups/New.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
10 changes: 10 additions & 0 deletions src/pages/dataElements/Edit.spec.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {})
})
5 changes: 4 additions & 1 deletion src/pages/dataElements/List.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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/)) {
Expand Down
12 changes: 12 additions & 0 deletions src/pages/dataElements/New.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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', () => {})
})
7 changes: 7 additions & 0 deletions src/pages/dataSets/List.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { generateDefaultListTests } from '../defaultListTests'

generateDefaultListTests({ componentName: 'Data sets' })

xdescribe('Data sets additional tests', () => {
it('should filter by form type', () => {})
})
21 changes: 21 additions & 0 deletions src/pages/defaultFormTests.tsx
Original file line number Diff line number Diff line change
@@ -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 ', () => {})
})
}
Loading
Loading