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

chore(deps): upgrade @dhis2/cli-app-scripts and @dhis2/ui #231

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-preview-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand All @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand All @@ -70,7 +70,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: End-to-End tests
uses: cypress-io/github-action@v2
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: End-to-End tests
uses: cypress-io/github-action@v2
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: End-to-End tests
uses: cypress-io/github-action@v2
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: actions/download-artifact@v2
with:
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"cypress:stub": "start-server-and-test 'yarn start:nobrowser' http://localhost:3000 'yarn cypress run --env dhis2ApiVersion=39,networkMode=stub'"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "^8.1.0",
"@dhis2/cli-app-scripts": "^10.2.0",
"@dhis2/cli-style": "^10.4.1",
"@dhis2/cypress-commands": "^9.0.2",
"@dhis2/cypress-plugins": "^9.0.2",
Expand All @@ -40,10 +40,15 @@
"dependencies": {
"@dhis2/app-runtime": "^3.2.1",
"@dhis2/prop-types": "^1.6.4",
"@dhis2/ui": "^7.2.7",
"@dhis2/ui": "^8.7.6",
Mohammer5 marked this conversation as resolved.
Show resolved Hide resolved
"history": "^5.0.1",
"prop-types": "^15.7.2",
"query-string": "^7.0.1",
"use-debounce": "^7.0.0"
},
"jest": {
"transformIgnorePatterns": [
"/!node_modules\\/multi-calendar-dates/"
]
}
}
11 changes: 8 additions & 3 deletions src/shared/approval-status/get-approval-status.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import {
} from './get-approval-status.js'
import { Approved, Ready, Waiting } from './icons.js'

const BASELINE_DATE_STR = '2020-01-01T00:00:00.000Z'

jest.mock('moment', () => {
return () => jest.requireActual('moment')('2020-01-01T00:00:00.000Z')
return () => jest.requireActual('moment')(BASELINE_DATE_STR)
})

describe('getApprovalStatusDisplayData', () => {
Expand All @@ -23,13 +25,16 @@ describe('getApprovalStatusDisplayData', () => {
})
})
it('returns the correct display data for approval status "ACCEPTED_HERE"', () => {
const yearDiff =
new Date().getFullYear() - new Date(BASELINE_DATE_STR).getFullYear()

expect(
getApprovalStatusDisplayData({
approvalStatus: APPROVAL_STATUSES.ACCEPTED_HERE,
approvedBy: 'Hendrik',
})
).toEqual({
displayName: 'Approval by Hendrik accepted 2 years ago',
displayName: `Approval by Hendrik accepted ${yearDiff} years ago`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: this test failure, was actually due to the fact that we've progressed one year in time

Copy link
Contributor

@kabaros kabaros Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking it might be more accurate to mock the underlying current date .. for this scenario, if diffing two dates, one in January 2023, the other in December 2022 .. I assume it would show one month ago while this custom logic would show 1 year ago .. more importantly, when it's around the end of the year, then this would show yearDiff + 1, I think

icon: Approved,
type: 'positive',
})
Expand Down Expand Up @@ -65,7 +70,7 @@ describe('getApprovalStatusDisplayData', () => {
approvalDateTime: 'Not empty',
})
).toEqual({
displayName: 'Approved by Hendrik 2 years ago',
displayName: 'Approved by Hendrik 3 years ago',
icon: Approved,
type: 'positive',
})
Expand Down
16 changes: 14 additions & 2 deletions src/top-bar/context-select/context-select.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { IconChevronDown24, IconChevronUp24, Popover, Tooltip } from '@dhis2/ui'
import {
IconChevronDown24,
IconChevronUp24,
Layer,
Popover,
Tooltip,
} from '@dhis2/ui'
import { shallow } from 'enzyme'
import React from 'react'
import { ContextSelect } from './context-select.js'
Expand Down Expand Up @@ -74,7 +80,13 @@ describe('<ContextSelect>', () => {
})

it('calls onClose when the backdrop layer is clicked', () => {
wrapper.find(Popover).dive().simulate('click')
wrapper
.find(Popover)
.dive()
.find(Layer)
.dive()
.find('.backdrop')
Mohammer5 marked this conversation as resolved.
Show resolved Hide resolved
.simulate('click')

expect(onClose).toHaveBeenCalledTimes(1)
})
Expand Down
5 changes: 4 additions & 1 deletion src/top-bar/org-unit-select/org-unit-select.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CustomDataProvider } from '@dhis2/app-runtime'
import { Popover, OrganisationUnitTree, Tooltip } from '@dhis2/ui'
import { Popover, OrganisationUnitTree, Tooltip, Layer } from '@dhis2/ui'
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { shallow } from 'enzyme'
Expand Down Expand Up @@ -272,6 +272,9 @@ describe('<OrgUnitSelect>', () => {
.dive()
.find(Popover)
.dive()
.find(Layer)
.dive()
.find('.backdrop')
.simulate('click')

expect(setOpenedSelect).toHaveBeenCalledTimes(1)
Expand Down
5 changes: 4 additions & 1 deletion src/top-bar/period-select/period-select.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useConfig } from '@dhis2/app-runtime'
import { Popover, MenuItem, Tooltip } from '@dhis2/ui'
import { Popover, MenuItem, Tooltip, Layer } from '@dhis2/ui'
import { shallow } from 'enzyme'
import React from 'react'
import { useAppContext } from '../../app-context/index.js'
Expand Down Expand Up @@ -234,6 +234,9 @@ describe('<PeriodSelect>', () => {
.dive()
.find(Popover)
.dive()
.find(Layer)
.dive()
.find('.backdrop')
.simulate('click')

expect(setOpenedSelect).toHaveBeenCalledTimes(1)
Expand Down
5 changes: 4 additions & 1 deletion src/top-bar/workflow-select/workflow-select.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Popover } from '@dhis2/ui'
import { Layer, Popover } from '@dhis2/ui'
import { shallow } from 'enzyme'
import React from 'react'
import { useAppContext } from '../../app-context/index.js'
Expand Down Expand Up @@ -173,6 +173,9 @@ describe('<WorkflowSelect>', () => {
.dive()
.find(Popover)
.dive()
.find(Layer)
.dive()
.find('.backdrop')
.simulate('click')

expect(setOpenedSelect).toHaveBeenCalledTimes(1)
Expand Down
Loading