Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshiGupta committed Jun 22, 2021
1 parent 294cbb3 commit 8951776
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const originalDeployment = {
'image.openshift.io/triggers':
'[{"from":{"kind":"ImageStreamTag","name":"nationalparks-py:latest","namespace":"div"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"nationalparks-py\\")].image","pause":"false"}]',
'openshift.io/generated-by': 'OpenShiftWebConsole',
'app.openshift.io/connects-to': 'database',
'deployment.kubernetes.io/revision': '4',
},
name: 'nationalparks-py',
namespace: 'div',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ describe('resource-label-utils', () => {
});
});

it('should return mergedData with newResource annotations ', () => {
it('should return mergedData with default and user annotations with correct values', () => {
const mergedResource = mergeData(originalDeployment, newDeployment);
expect(mergedResource.metadata.annotations).toEqual(newDeployment.metadata.annotations);
expect(mergedResource.metadata.annotations).toEqual({
'alpha.image.policy.openshift.io/resolve-names': '*',
'app.openshift.io/vcs-ref': 'master',
'app.openshift.io/vcs-uri': 'https://github.com/divyanshiGupta/nationalparks-py',
'image.openshift.io/triggers':
'[{"from":{"kind":"ImageStreamTag","name":"nationalparks-py:latest","namespace":"div"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"nationalparks-py\\")].image","pause":"true"}]',
'openshift.io/generated-by': 'OpenShiftWebConsole',
'app.openshift.io/connects-to': 'database',
'deployment.kubernetes.io/revision': '4',
});
});

it('should return mergedData with newResource and originalResource annotations if originalResource is a devfile resource', () => {
Expand Down

0 comments on commit 8951776

Please sign in to comment.