-
Notifications
You must be signed in to change notification settings - Fork 1
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
ALCS-2345 Added unit tests #1948
Conversation
@@ -33,4 +51,75 @@ describe('NoticeOfIntentTagService', () => { | |||
it('should be defined', () => { | |||
expect(service).toBeDefined(); | |||
}); | |||
|
|||
it('should add tag to the application if not existing', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change application to noi
expect(noiRepositoryMock.save).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should raise an error if application is not found', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
await expect(service.addTagToNoticeOfIntent('noi-1', 'tag-name')).rejects.toThrow(ServiceNotFoundException); | ||
}); | ||
|
||
it('should raise an error if the application already has the tag', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
await expect(service.addTagToNoticeOfIntent('noi-1', 'tag-name')).rejects.toThrow(ServiceValidationException); | ||
}); | ||
|
||
it('should throw an error if the application does not have any tags when deleting', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
await expect(service.removeTagFromNoticeOfIntent('noi-1', 'tag-name')).rejects.toThrow(ServiceValidationException); | ||
}); | ||
|
||
it('should throw an error if the application does not have the tag requested when deleting', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
await expect(service.removeTagFromNoticeOfIntent('noi-1', 'tag-name')).rejects.toThrow(ServiceValidationException); | ||
}); | ||
|
||
it('should delete the tag from application if exists', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
expect(noiRepositoryMock.save).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should return application tags', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
expect(result.length).toEqual(1); | ||
}); | ||
|
||
it('should return empty array if application does not have tags', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Unit tests added