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

[ACS-6252] support disabling the tags and categories feature in the applications #9106

Conversation

AleksanderSklorz
Copy link
Contributor

@AleksanderSklorz AleksanderSklorz commented Nov 22, 2023

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)
https://alfresco.atlassian.net/browse/ACS-6252

What is the new behaviour?
Allowing to hide things related with tags and categories features.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:
ACA PR: Alfresco/alfresco-content-app#3533
alfresco-applications PR: https://github.com/Alfresco/alfresco-applications/pull/439

spyOn(nodeService, 'getNode').and.returnValue(delayResult);
spyOn(aspectListService, 'getAspects').and.returnValue(delayResult);
spyOn(nodeService, 'getNode').and.returnValue(of(null).pipe(delay(0)));
spyOn(aspectListService, 'getAspects').and.returnValue(of([]).pipe(delay(0)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Does adding delay(0) have any difference as opposed to not having it at all? I would assume the default value for delay is 0 anyways

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

it('should not show aspect if it is excluded aspect', () => {
component.excludedAspects = ['cst:nonamedAspect'];

fixture.detectChanges();
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought maybe we can leave fixture.detectChanges(); call in beforeEach and just call it again only in this test case? I know that it will be called twice but then you wouldn't have to manually call it in every other test case, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't call it twice because it is in ngOnInit which be triggered for first execution of detectChanges. But I have prepared now two separate describe blocks so now I can use detectChanges in beforeEach for rest tests.

it('should return true if get from AppConfigService returns true', () => {
getSpy.and.returnValue(true);

const enabledCategories = categoryService.areCategoriesEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you don't need to create a extra variable here, you can just call areCategoriesEnabled in the expect block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, done

it('should return false if get from AppConfigService returns false', () => {
getSpy.and.returnValue(false);

const enabledCategories = categoryService.areCategoriesEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

it('should return true if get from AppConfigService returns true', () => {
getSpy.and.returnValue(true);

const enabledTags = service.areTagsEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

it('should return false if get from AppConfigService returns false', () => {
getSpy.and.returnValue(false);

const enabledTags = service.areTagsEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@AleksanderSklorz AleksanderSklorz force-pushed the ACS-6252-Support-disabling-the-Tags-and-Categories-feature-in-the-applications branch 4 times, most recently from 9057263 to eb22223 Compare November 27, 2023 11:39
@AleksanderSklorz AleksanderSklorz force-pushed the ACS-6252-Support-disabling-the-Tags-and-Categories-feature-in-the-applications branch from eb22223 to 2180e96 Compare November 28, 2023 07:14
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@AleksanderSklorz AleksanderSklorz merged commit 7793aba into develop Nov 28, 2023
33 checks passed
@AleksanderSklorz AleksanderSklorz deleted the ACS-6252-Support-disabling-the-Tags-and-Categories-feature-in-the-applications branch November 28, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants