mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-3379] Fix unit tests for the visibility rules of the folder rules (#2576)
* [ACS-3379] Fix unit tests for the visibility rules of the folder rules * Add stage to .travis.yml so unit tests run on Travis * Karma singleRun: true so that Travis doesn't stall
This commit is contained in:
parent
30eebfa1e2
commit
38cae75476
@ -85,6 +85,11 @@ jobs:
|
||||
script: npm ci && ng test aca-settings
|
||||
cache: false
|
||||
|
||||
- stage: Quality and Unit tests
|
||||
name: 'Unit tests: aca-folder-rules'
|
||||
script: npm ci && ng test aca-folder-rules
|
||||
cache: false
|
||||
|
||||
- stage: Quality and Unit tests
|
||||
name: 'Unit tests: ACA'
|
||||
script:
|
||||
|
@ -26,7 +26,7 @@ module.exports = function (config) {
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
singleRun: true,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
|
@ -24,9 +24,9 @@
|
||||
*/
|
||||
|
||||
import { AcaRuleContext } from '@alfresco/aca-shared/rules';
|
||||
import { isFolderRulesEnabled, canCreateFolderRule, canLinkFolderRule } from './folder-rules.rules';
|
||||
import { isFolderRulesEnabled, canManageFolderRules } from './folder-rules.rules';
|
||||
|
||||
describe('Folder Rules', () => {
|
||||
describe('Folder Rules Visibility Rules', () => {
|
||||
describe('isFolderRulesEnabled', () => {
|
||||
it('should have the feature enabled', () => {
|
||||
const context: any = {
|
||||
@ -51,7 +51,7 @@ describe('Folder Rules', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('canCreateFolderRule', () => {
|
||||
describe('canManageFolderRules', () => {
|
||||
let context: AcaRuleContext;
|
||||
|
||||
beforeEach(() => {
|
||||
@ -72,47 +72,14 @@ describe('Folder Rules', () => {
|
||||
});
|
||||
|
||||
it('should allow creating a rule for the selected folder', () => {
|
||||
const result = canCreateFolderRule(context);
|
||||
const result = canManageFolderRules(context);
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not allow creating a rule if no folder selected', () => {
|
||||
context.selection.folder = null;
|
||||
|
||||
const result = canCreateFolderRule(context);
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('canLinkFolderRule', () => {
|
||||
let context: AcaRuleContext;
|
||||
|
||||
beforeEach(() => {
|
||||
context = {
|
||||
appConfig: {
|
||||
get: () => true
|
||||
},
|
||||
selection: {
|
||||
folder: {} as any
|
||||
},
|
||||
navigation: {
|
||||
url: '/personal-files'
|
||||
},
|
||||
permissions: {
|
||||
check: () => true
|
||||
}
|
||||
} as any;
|
||||
});
|
||||
|
||||
it('should allow linking rule for the selected folder', () => {
|
||||
const result = canLinkFolderRule(context);
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not allow linking rule if no folder selected', () => {
|
||||
context.selection.folder = null;
|
||||
|
||||
const result = canLinkFolderRule(context);
|
||||
const result = canManageFolderRules(context);
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user