Skip to content
Draft
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 @@ -51,7 +51,7 @@
},
"dependencies": {
"@dhis2/app-runtime": "^3.14.5",
"@dhis2/multi-calendar-dates": "^1.3.2",
"@dhis2/multi-calendar-dates": "^2.1.3-alpha.3",
"@dhis2/ui": "^10.1.11",
"@dhis2/ui-forms": "7.16.3",
"@tanstack/react-query": "4.24.10",
Expand Down Expand Up @@ -79,6 +79,9 @@
"use-query-params": "1.2.3",
"zustand": "4.1.5"
},
"resolutions": {
"@dhis2/multi-calendar-dates": "^2.1.3-alpha.3"
},
"engines": {
"node": ">=14.0.0"
},
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe('usePeriods', () => {
})
})

describe.skip('usePeriods (ethiopian)', () => {
describe('usePeriods (ethiopian)', () => {
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
4 changes: 2 additions & 2 deletions src/data-workspace/inputs/date-input.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,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 +223,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