Skip to content

Commit

Permalink
Update node js and fix failing unit tests (#1119)
Browse files Browse the repository at this point in the history
* fixed unhandled promise rejection

...which fixes locally failing jest test

* fix failing unit test for UserProfile

* udpate node js and npm for CI tests

* make test a bit more specific

* set node js to 16.x

* update node js to 16.x and npm to 8.15 in Dockerfile

* revert npm version change
  • Loading branch information
pieterlukasse authored and cmlsn committed Nov 29, 2022
1 parent 0410491 commit a00400f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
time \
vim \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
Expand Down
3 changes: 3 additions & 0 deletions src/Submission/MapDataModel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ class MapDataModel extends React.Component {
if (data && data[this.state.parentNodeType]) {
this.setState((prevState) => ({ validParentIds: data[prevState.parentNodeType] }));
}
}).catch(error => {
// TODO - should we throw this error?
console.error(error);
});
} else {
this.setState({ validParentIds: [] });
Expand Down
5 changes: 3 additions & 2 deletions src/UserProfile/UserProfile.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ describe('the UserProfile component', () => {
/>
</StaticRouter>,
);
expect($vdom.find('tbody tr')).toHaveLength(testProps.userProfile.jtis.length + 1);
// we expect one delete button per jti:
expect($vdom.find(`button[name="${DELETE_BTN}"]`)).toHaveLength(testProps.userProfile.jtis.length);
});

it('triggers create-key events', (done) => {
Expand Down Expand Up @@ -79,7 +80,7 @@ describe('the UserProfile component', () => {
</StaticRouter>,
);
const $deleteBtn = $vdom.find(`button[name="${DELETE_BTN}"]`);
expect($deleteBtn).toHaveLength(2);
expect($deleteBtn).toHaveLength(testProps.userProfile.jtis.length);
$deleteBtn.at(0).simulate('click');
// should invoke onRequestDeleteKey callback (above - calls done()) ...
});
Expand Down

0 comments on commit a00400f

Please sign in to comment.