Skip to content
Open
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
16 changes: 7 additions & 9 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ jobs:
uses: dhis2/workflows-platform/.github/workflows/lint.yml@v1
test:
uses: dhis2/workflows-platform/.github/workflows/test.yml@v1
e2e:
uses: dhis2/workflows-platform/.github/workflows/legacy-e2e.yml@v1
# Disabling tests for now
if: false
# Skips forks and dependabot PRs
# if: '!github.event.push.repository.fork'
secrets: inherit
with:
api_version: 41
# e2e:
# uses: dhis2/workflows-platform/.github/workflows/legacy-e2e.yml@v1
# # Skips forks and dependabot PRs
# if: '!github.event.push.repository.fork'
# secrets: inherit
# with:
# api_version: 41
release:
needs: [lint-commits, lint, test]
uses: dhis2/workflows-platform/.github/workflows/release.yml@v1
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"cypress:live": "yarn cypress:prepare 'yarn cypress:open:live'",
"cypress:capture": "yarn cypress:prepare 'yarn cypress:run:capture'",
"cypress:stub": "yarn cypress:prepare 'yarn cypress:run:stub'",
"jgs:start": "BROWSER=none yarn start --proxy https://debug.dhis2.org/dev"
"jgs:start": "BROWSER=none yarn start --proxy https://debug.dhis2.org/dev",
"postinstall": "patch-package"
},
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
Expand All @@ -47,6 +48,8 @@
"fake-indexeddb": "4.0.1",
"identity-obj-proxy": "^3.0.0",
"jest-extended": "^4.0.2",
"patch-package": "^8.0.1",
"postinstall-postinstall": "^2.1.0",
"start-server-and-test": "1.15.4"
},
"dependencies": {
Expand Down
33,457 changes: 33,457 additions & 0 deletions patches/@js-temporal+polyfill+0.4.3.patch

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -386,55 +386,55 @@ describe('useDateLimit (time zones)', () => {
})
})

// describe.each([
// ['2017-13-03', reversedPeriodTypesMapping.DAILY, 0, '2017-13-03'],
// ['2017-02-30', reversedPeriodTypesMapping.DAILY, 0, '2017-02-30'],
// ['2017-02-30', reversedPeriodTypesMapping.WEEKLY, 0, '2017-02-26'],
// ['2017-13-02', reversedPeriodTypesMapping.WEEKLY, 0, '2017-12-27'],
// ['2017-01-01', reversedPeriodTypesMapping.MONTHLY, 0, '2017-01-01'],
// ['2017-02-30', reversedPeriodTypesMapping.MONTHLY, 0, '2017-02-01'],
// ['2017-13-03', reversedPeriodTypesMapping.DAILY, 4, '2018-01-02'],
// ['2017-02-30', reversedPeriodTypesMapping.DAILY, 10, '2017-03-10'],
// ['2017-02-30', reversedPeriodTypesMapping.WEEKLY, 3, '2017-03-17'],
// ['2017-13-02', reversedPeriodTypesMapping.WEEKLY, 13, '2018-03-23'],
// ['2017-01-01', reversedPeriodTypesMapping.MONTHLY, 5, '2017-06-01'],
// ['2017-02-30', reversedPeriodTypesMapping.MONTHLY, 15, '2018-05-01'],
// ])(
// 'useDateLimit (ethiopian calendar)',
// // eslint-disable-next-line max-params
// (currentDate, periodType, openFuturePeriods, expectedDate) => {
// beforeEach(() => {
// useConfig.mockImplementation(() => ({
// systemInfo: { calendar: 'ethiopian', timeZone: 'Etc/UTC' },
// }))
// })

// afterEach(() => {
// jest.clearAllMocks()
// })

// it(`should be ${expectedDate} if current date: ${currentDate}, periodType: ${periodType}, openFuturePeriods: ${openFuturePeriods}`, () => {
// jest.spyOn(
// getNowInCalendarFunctions,
// 'getNowInCalendarString'
// ).mockImplementation(() => currentDate)
// useMetadata.mockImplementationOnce(() => ({
// data: {
// dataSets: {
// dataSetId: {
// id: 'dataSetId',
// periodType,
// openFuturePeriods,
// },
// },
// },
// }))

// const { result } = renderHook(() => useDateLimit())
// expect(result.current).toEqual(expectedDate)
// })
// }
// )
describe.each([
['2017-13-03', reversedPeriodTypesMapping.DAILY, 0, '2017-13-03'],
['2017-02-30', reversedPeriodTypesMapping.DAILY, 0, '2017-02-30'],
['2017-02-30', reversedPeriodTypesMapping.WEEKLY, 0, '2017-02-26'],
['2017-13-02', reversedPeriodTypesMapping.WEEKLY, 0, '2017-12-27'],
['2017-01-01', reversedPeriodTypesMapping.MONTHLY, 0, '2017-01-01'],
['2017-02-30', reversedPeriodTypesMapping.MONTHLY, 0, '2017-02-01'],
['2017-13-03', reversedPeriodTypesMapping.DAILY, 4, '2018-01-02'],
['2017-02-30', reversedPeriodTypesMapping.DAILY, 10, '2017-03-10'],
['2017-02-30', reversedPeriodTypesMapping.WEEKLY, 3, '2017-03-17'],
['2017-13-02', reversedPeriodTypesMapping.WEEKLY, 13, '2018-03-23'],
['2017-01-01', reversedPeriodTypesMapping.MONTHLY, 5, '2017-06-01'],
['2017-02-30', reversedPeriodTypesMapping.MONTHLY, 15, '2018-05-01'],
])(
'useDateLimit (ethiopian calendar)',
// eslint-disable-next-line max-params
(currentDate, periodType, openFuturePeriods, expectedDate) => {
beforeEach(() => {
useConfig.mockImplementation(() => ({
systemInfo: { calendar: 'ethiopian', timeZone: 'Etc/UTC' },
}))
})

afterEach(() => {
jest.clearAllMocks()
})

it(`should be ${expectedDate} if current date: ${currentDate}, periodType: ${periodType}, openFuturePeriods: ${openFuturePeriods}`, () => {
jest.spyOn(
getNowInCalendarFunctions,
'getNowInCalendarString'
).mockImplementation(() => currentDate)
useMetadata.mockImplementationOnce(() => ({
data: {
dataSets: {
dataSetId: {
id: 'dataSetId',
periodType,
openFuturePeriods,
},
},
},
}))

const { result } = renderHook(() => useDateLimit())
expect(result.current).toEqual(expectedDate)
})
}
)

describe.each([
['2076-04-32', reversedPeriodTypesMapping.DAILY, 0, '2076-04-32'],
Expand Down
13 changes: 11 additions & 2 deletions src/context-selection/period-selector-bar-item/use-periods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ jest.mock('../../shared/use-user-info/use-user-info.js', () => ({
})),
}))

describe('usePeriods', () => {
/**
* skipping until https://dhis2.atlassian.net/browse/LIBS-763 is done
*/
describe.skip('usePeriods', () => {
const actualSystemTime = new Date()
jest.useFakeTimers()

Expand Down Expand Up @@ -288,6 +291,9 @@ describe('usePeriods', () => {
})
})

/**
* skipping until https://dhis2.atlassian.net/browse/LIBS-763 is done
*/
describe.skip('usePeriods (ethiopian)', () => {
beforeEach(() => {
jest.useFakeTimers('modern')
Expand Down Expand Up @@ -433,7 +439,10 @@ describe.skip('usePeriods (ethiopian)', () => {
})
})

describe('usePeriods (nepali)', () => {
/**
* skipping until https://dhis2.atlassian.net/browse/LIBS-763 is done
*/
describe.skip('usePeriods (nepali)', () => {
beforeEach(() => {
jest.useFakeTimers('modern')
jest.setSystemTime(new Date('2024-07-15T12:00:00').getTime())
Expand Down
2 changes: 1 addition & 1 deletion src/data-workspace/data-details-sidebar/audit-log.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('<AuditLog />', () => {
).toBeInTheDocument()
})

it.skip('renders the date/datetime values in system calendar (ethiopian)', async () => {
it('renders the date/datetime values in system calendar (ethiopian)', async () => {
useConfig.mockImplementation(() => ({
systemInfo: {
calendar: 'ethiopian',
Expand Down
11 changes: 7 additions & 4 deletions src/data-workspace/inputs/date-input.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ jest.mock('@dhis2/app-runtime', () => {
const DE = 'rkAZZFGFEQ7'
const COC = 'HllvX50cXC0'

describe('date input field', () => {
/**
* skipping until https://dhis2.atlassian.net/browse/LIBS-763 is done
*/
describe.skip('date input field', () => {
const props = {
cocId: COC,
deId: DE,
Expand Down Expand Up @@ -105,7 +108,7 @@ describe('date input field', () => {
expect(calendarInput.value).toBe('')
})

it('allows user to navigate calendar component', async () => {
it.skip('allows user to navigate calendar component', async () => {
useConfig.mockReturnValue({
systemInfo: { calendar: 'gregorian' },
})
Expand Down Expand Up @@ -202,7 +205,7 @@ describe('date input field', () => {
expect(calendarInput.value).toBe('2078-01-09')
})

it.skip('renders system set calendar, i.e. ethiopian', async () => {
it('renders system set calendar, i.e. ethiopian', async () => {
useConfig.mockReturnValue({
systemInfo: { calendar: 'ethiopian' },
})
Expand All @@ -223,7 +226,7 @@ describe('date input field', () => {
expect(mutate.mock.calls[0][0]).toHaveProperty('value', '2024-07-25')
})

it.skip('populates the ethiopian equivalent of the persisted ISO date', async () => {
it('populates the ethiopian equivalent of the persisted ISO date', async () => {
jest.setSystemTime(new Date('2024-07-25T09:05:00.000Z'))

useConfig.mockReturnValue({
Expand Down
6 changes: 3 additions & 3 deletions src/data-workspace/inputs/datetime-input.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('date input field', () => {
expect(mutate.mock.calls[0][0]).toHaveProperty('value', '')
})

it.skip('posts ISO date to backend with ethiopian calendar', async () => {
it('posts ISO date to backend with ethiopian calendar', async () => {
// this is 2016-02-30 Ethopian
jest.setSystemTime(new Date('2023-11-10T09:05:00.000Z'))
const user = userEvent.setup({ delay: null })
Expand Down Expand Up @@ -259,7 +259,7 @@ describe('date input field', () => {
)
})

it.skip('populates the ethiopian equivalent of the persisted ISO date', async () => {
it('populates the ethiopian equivalent of the persisted ISO date', async () => {
jest.setSystemTime(new Date('2024-07-25T09:05:00.000Z'))

useConfig.mockReturnValue({
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('date input field', () => {
systemInfo: { calendar: 'nepali' },
})

// 2021-04-22 ISO = 2078-01-09 nepali
// 2021-04-22 ISO = 2078-01-09 ethiopian
const { getByRole, getByTestId } = render(
<DateTimeInput {...props} initialValue="2021-04-22T13:17" />
)
Expand Down
48 changes: 24 additions & 24 deletions src/shared/date/date-text.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,30 @@ describe('DateText', () => {
null,
'2024-10-14 19:10',
],
// [
// '2024-10-14T19:10:57.836',
// 'yyyy-mm-dd',
// 'ethiopian',
// 'Etc/UTC',
// false,
// '2017-02-04 19:10',
// ],
// [
// '2024-10-14T19:10:57.836',
// 'yyyy-mm-dd',
// 'ethiopian',
// 'Africa/Addis_Ababa',
// false,
// '2017-02-04 16:10',
// ],
// [
// '2024-10-14T19:10:57.836',
// 'yyyy-mm-dd',
// 'ethiopian',
// 'Africa/Addis_Ababa',
// true,
// '2017-02-04 16:10 (UTC)',
// ],
[
'2024-10-14T19:10:57.836',
'yyyy-mm-dd',
'ethiopian',
'Etc/UTC',
false,
'2017-02-04 19:10',
],
[
'2024-10-14T19:10:57.836',
'yyyy-mm-dd',
'ethiopian',
'Africa/Addis_Ababa',
false,
'2017-02-04 16:10',
],
[
'2024-10-14T19:10:57.836',
'yyyy-mm-dd',
'ethiopian',
'Africa/Addis_Ababa',
true,
'2017-02-04 16:10 (UTC)',
],
[
'2024-10-14T19:10:57.836',
'yyyy-mm-dd',
Expand Down
8 changes: 4 additions & 4 deletions src/shared/date/date-utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('isDateALessThanDateB (nepali)', () => {
})
})

describe.skip('isDateALessThanDateB (ethiopian)', () => {
describe('isDateALessThanDateB (ethiopian)', () => {
beforeEach(() => {
jest.spyOn(console, 'error').mockImplementation(jest.fn())
})
Expand Down Expand Up @@ -142,7 +142,7 @@ describe.skip('isDateALessThanDateB (ethiopian)', () => {
})
})

describe.skip('isDateALessThanDateB (mixed calendars)', () => {
describe('isDateALessThanDateB (mixed calendars)', () => {
beforeEach(() => {
jest.spyOn(console, 'error').mockImplementation(jest.fn())
})
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('addDaysToDateString', () => {
expect(result).toBe('2023-03-20T12:00:00')
})

it.skip('works with ethiopian calendar', () => {
it('works with ethiopian calendar', () => {
const startDateString = '2016-02-30'
const days = 5
const calendar = 'ethiopian'
Expand Down Expand Up @@ -315,7 +315,7 @@ describe('getRelativeTime', () => {
jest.useRealTimers()
})

it.skip('works with ethiopian calendar', () => {
it('works with ethiopian calendar', () => {
// 2024-06-15 Ethiopian = 2032-02-23 (i.e. in 8 years)
const startDate = '2024-06-15T13:00:00'
const calendar = 'ethiopian'
Expand Down
2 changes: 1 addition & 1 deletion src/shared/date/get-now-in-calendar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('getNowInCalendarString', () => {
expect(result).toBe('2081-03-01T12:00:00')
})

it.skip('handles ethiopian calendar', () => {
it('handles ethiopian calendar', () => {
const long = true
const calendar = 'ethiopian'
const result = getNowInCalendarString({ long, calendar })
Expand Down
4 changes: 2 additions & 2 deletions src/shared/locked-status/use-check-lock-status.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('useCheckLockStatus', () => {
})
})

it.skip('locks if org unit closes before period ends (ethiopian calendar)', () => {
it('locks if org unit closes before period ends (ethiopian calendar)', () => {
const setLockedStatusMocked = jest.fn()
jest.spyOn(
useLockedContextModule,
Expand Down Expand Up @@ -481,7 +481,7 @@ describe('useCheckLockStatus', () => {

// this test confirms that we do not have functionality to add days to non-gregory days
// i.e., we'd like this test to fail eventually when we add ability to add days to non-gregory dates
it.skip('does not set lockDate based on expiry days if calendar is non-gregory ', () => {
it('does not set lockDate based on expiry days if calendar is non-gregory ', () => {
jest.useFakeTimers('modern')
jest.setSystemTime(new Date('2024-02-04'))
useConfig.mockImplementationOnce(() => ({
Expand Down
Loading
Loading