mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
[ACS-8484] Add feature flag to knowledge retrieval (#4003)
This commit is contained in:
committed by
Aleksander Sklorz
parent
a577285cd9
commit
c45e4501d1
@@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
import * as app from './app.rules';
|
||||
import { getFileExtension } from './app.rules';
|
||||
import { TestRuleContext } from './test-rule-context';
|
||||
import { NodeEntry, RepositoryInfo, StatusInfo } from '@alfresco/js-api';
|
||||
import { getFileExtension } from './app.rules';
|
||||
|
||||
describe('app.evaluators', () => {
|
||||
let context: TestRuleContext;
|
||||
@@ -540,6 +540,47 @@ describe('app.evaluators', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isKnowledgeRetrievalEnabled', () => {
|
||||
it('should call context.appConfig.get with correct parameters', () => {
|
||||
context.appConfig = { get: jasmine.createSpy() } as any;
|
||||
|
||||
app.canDisplayKnowledgeRetrievalButton(context);
|
||||
expect(context.appConfig.get).toHaveBeenCalledWith('plugins.knowledgeRetrievalEnabled', true);
|
||||
});
|
||||
|
||||
it('should return false if get from appConfig returns false', () => {
|
||||
expect(
|
||||
app.canDisplayKnowledgeRetrievalButton({
|
||||
appConfig: {
|
||||
get: () => false
|
||||
}
|
||||
} as any)
|
||||
).toBeFalse();
|
||||
});
|
||||
|
||||
it('should return true if get from appConfig returns true and navigation is correct', () => {
|
||||
expect(
|
||||
app.canDisplayKnowledgeRetrievalButton({
|
||||
navigation: { url: '/personal-files' },
|
||||
appConfig: {
|
||||
get: () => true
|
||||
}
|
||||
} as any)
|
||||
).toBeTrue();
|
||||
});
|
||||
|
||||
it('should return false if get from appConfig returns true, but navigation is not correct', () => {
|
||||
expect(
|
||||
app.canDisplayKnowledgeRetrievalButton({
|
||||
navigation: { url: '/my-special-files' },
|
||||
appConfig: {
|
||||
get: () => true
|
||||
}
|
||||
} as any)
|
||||
).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isContentServiceEnabled', () => {
|
||||
it('should call context.appConfig.get with correct parameters', () => {
|
||||
context.appConfig = { get: jasmine.createSpy() } as any;
|
||||
|
@@ -631,8 +631,9 @@ export const areTagsEnabled = (context: AcaRuleContext): boolean => context.appC
|
||||
export const areCategoriesEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.categoriesEnabled', true);
|
||||
|
||||
export const canDisplayKnowledgeRetrievalButton = (context: AcaRuleContext): boolean =>
|
||||
navigation.isPersonalFiles(context) ||
|
||||
navigation.isSharedFiles(context) ||
|
||||
navigation.isRecentFiles(context) ||
|
||||
navigation.isFavorites(context) ||
|
||||
((navigation.isSearchResults(context) || navigation.isLibraryContent(context)) && navigation.isNotLibraries(context));
|
||||
context.appConfig.get('plugins.knowledgeRetrievalEnabled', true) &&
|
||||
(navigation.isPersonalFiles(context) ||
|
||||
navigation.isSharedFiles(context) ||
|
||||
navigation.isRecentFiles(context) ||
|
||||
navigation.isFavorites(context) ||
|
||||
((navigation.isSearchResults(context) || navigation.isLibraryContent(context)) && navigation.isNotLibraries(context)));
|
||||
|
Reference in New Issue
Block a user